Answer for Kodekloud DEVOPS Questions - Puppet create a file

The Puppetmaster and Puppet agent nodes have been set up by the Nautilus DevOps team so they can perform testing. In Stratos DC all app servers have been configured as Puppet agent nodes. Below are details about the testing scenario they want to proceed with.

Use Puppet file resource and perform the task below:

1. Create a Puppet programming file ecommerce.pp under /etc/puppetlabs/code/environments/production/manifests directory on master node i.e Jump Server.

2. Using /etc/puppetlabs/code/environments/production/manifests/ecommerce.pp create a file media.txt under /opt/security directory on App Server 1.

Note: Please perform this task using ecommerce.pp only, do not create any separate inventory file.


Sample Answer: 

        # create the .pp file with the name given in the question

                vi <file-name>.pp


        # add configuration as per the  

    node '<app-server-hostname>' {
file { '<path-given-in the question-with the file name>':
ensure => 'present',
path   => '<path-given-in the question-with the file name'}
}

# login to the app server and run 

                puppet agent -vt 

# check the path that file was created successfully 

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

No comments:

Post a Comment

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...