Question: Create a Puppet programming file blog.pp under /etc/puppetlabs/code/environments/production/manifests directory on master node i.e Jump Server. Using puppet file resource, perform the below mentioned tasks.
File beta.txt already exists under /opt/finance directory on App Server 3.
Add content Welcome to xFusionCorp Industries! in file beta.txt on App Server 3.
Set permissions 0744 for file beta.txt on App Server 3.
Note: Please perform this task using blog.pp only, do not create any separate inventory file.
Please Note :- Perform the below commands based on your question server, user name & other details might differ . So please read task carefully before executing. All the Best 👍
1. Go through the folder mentioned in task and create puppet file
vi /etc/puppetlabs/code/environments/production/manifests/blog.pp
2. Puppet user resource add a user on all app servers as mentioned in your task
( refer Video below for clarity )
class
file_modifier { |
3. Validate the puppet file by below command.
root@jump/etc/puppetlabs/code/environments/production/manifests# puppet parser
validate blog.pp root@jump_host /etc/puppetlabs/code/environments/production/manifests# |
4. Login on App server as per the task and run command
[banner@stapp03 ~]$ sudo su - Administrator. It usually boils down to these three things: #2) Think before
you type. #3) With great
power comes great responsibility. [root@stapp03
~]# puppet agent -tv Info: Using
configured environment 'production' Info: Retrieving
pluginfacts Info: Retrieving
plugin Info: Retrieving
locales Info: Caching
catalog for stapp03.stratos.xfusioncorp.com Info: Applying
configuration version '1623413693' Notice:
/Stage[main]/File_modifier/File[/opt/finance/beta.txt]/content: --- /opt/finance/beta.txt 2021-06-11 12:10:48.616000000 +0000 +++
/tmp/puppet-file20210611-190-1x9y725
2021-06-11 12:14:53.704000000 +0000 @@ -0,0 +1 @@ +Welcome to
xFusionCorp Industries! \ No newline at end of file Info: Computing
checksum on file /opt/finance/beta.txt Info:
/Stage[main]/File_modifier/File[/opt/finance/beta.txt]: Filebucketed /opt/finance/beta.txt
to puppet with sum d41d8cd98f00b204e9800998ecf8427e Notice:
/Stage[main]/File_modifier/File[/opt/finance/beta.txt]/content: content
changed '{md5}d41d8cd98f00b204e9800998ecf8427e' to '{md5}b899e8a90bbb38276f6a00012e1956fe' Notice:
/Stage[main]/File_modifier/File[/opt/finance/beta.txt]/mode: mode changed
'0644' to '0744' Notice: Applied
catalog in 0.09 seconds [root@stapp03 ~]# |
5.. Validate the task by running
[root@stapp03
~]# cat /opt/finance/beta.txt Welcome to xFusionCorp Industries! [root@stapp03
~]# |
6. Click on Finish & Confirm to complete the task successful
Happy Learning!!!!
2 Comments
How can I connect to root account on Jump server? Password is not provided in the task
ReplyDeleteyou need to sudo su - to get root account with user thor & password mjolnir123. kindly find the page for server Login Credentials https://www.nbtechsupport.co.in/2022/08/kodekloud-servers-login-credentials.html
Delete