Puppet: Writing simple manifests

Share At:

In my previous article, I wrote about how to build a puppet Master-client infrastructure.

In this article, we are going to learn how to write simple manifest to create “a user.”

Introduction to Puppet:

“Puppet is a Configuration Management tool that is used for deploying, configuring and managing servers.”

Puppet uses a Master Slave architecture in which the Master and Slave communicate through a secure encrypted channel with the help of SSL.

Scenario 1: Steps to create a user in all the servers ( That includes puppet master and client servers):

  1. Please change to “/etc/puppetlabs/code/environments/production/manifests” on your Puppet -Master server. You will see something like below:

2. Now open site.pp in your text editor and modify it to look something like below:

3. Run “puppet parser validate site.pp” command to check if there’s any syntax error.

4. Run “puppet apply — noop site.pp” command to run it in Dry-run mode.(Note: It will not perform the actual user creation).

5. Now run “ puppet apply site.pp” to perform actual user creation.

6. Validate if the user has been created on “Puppet-Master” server.

7. Now go to the client server and run below command.

puppet agent -t -d

This command will fetch required details from puppet master and perform the user creation on puppet-client.

8. Now validate that the user “abhi” has been created on puppet client:

That’s it. The user has been created on both Puppet-Master and puppet client.

Scenario 2: Steps to create a user in specific nodes only:

  1. On puppet master : Modify the site.pp to look like below.

This manifest will create user only on Puppet-Client server called “node1.unixlab.com”.

2. Once you have modified the site.pp file, run below commands on Puppet Master server:

puppet parser validate site.pp

puppet apply — noop site.pp

3. You will see, the user called rahul doesn’t exist on Puppet-Master server:

4. Now login to Puppet Client server and run below command:

puppet agent -t

5. You will see, the user “rahul” has been created on “puppet-client”.

We are all set.

Happy Learning !!!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Back To Top

Contact Us