Puppet is one of the most enterprise adopted configuration management tools in the DevOps world. As a DevOps engineer, you must know how to set up a puppet on your system. But before we begin, let me tell you that installing a puppet is not an easy task at all. If you miss a single step or if you change the flow of steps mentioned in this tutorial, even at one place, you might be scratching your head all day with a lot of error, but your setup would be incomplete. So, follow each step very carefully. Puppet has client-server architecture, which consists of a puppet master (server) and puppet agents (client). Puppet Master has all the configurations, and it compiles and supplies the configurations to puppet agents. Puppet Agents send the facts to puppet master requesting catalogs in intervals. Puppet Master sends the back the requested catalog to the puppet agent. Puppet Agent then applies that catalog on the node and reports back to the master. Now that you have a basic understanding of Puppet let’s get started and set up a Puppet Master and Puppet Agent.

Environment Details

I am using 2 Ubuntu 18.04 machines. One will act as a puppet master and the other one as a puppet agent. Below are the details of the machines: Puppet Master (Server)

Hostname: puppet, puppet.geekflate.com IP Address: 192.168.0.108

Puppet Agent (Client)

Hostname: puppetagent Ip Address: 192.168.0.107

Installing Puppet Server

Before I begin the installation, I need to edit the /etc/hosts file on both master and agent so that they can resolve each other. On the Master node On Agent Node ­Now, I need to get a puppet repository on my master node and update it. Download the puppet repository. Add and configure puppet 6 repo. Update the repository list.

Installing Puppet Server

Let’s run the below command on the master node to install the puppet server on it.

Configuring Puppet Server

 Edit the puppetserver file, as shown below. This to configure JVM of the puppet server.  Edit puppet configuration file to modify puppet server settings. Puppet Server needs to generate a root and intermediate signing, CA.  Start and enable the puppet server service.

Installing Puppet Agent

Follow the below steps on the agent node as you did for the master system. Puppet repository needs to present on all the agent nodes. Run the below command on the agent node to install the puppet agent.

Configuring Puppet Agent

 Edit the puppet configuration file on the agent node. Run the below command to start the puppet service. This command will also start automatically after it boots.

Generate and Sign Certificates

When the agent starts for the first time, it sends a certificate signing request to the puppet master. The master needs to check and sign this certificate. After this, the agent will fetch catalogs from the master and apply them to agent nodes regularly. Now that the puppet agent is running run the below command on the master node to check if it has received any certificate signing request. On the Master Node Sign the certificate sent by the agent. Run the below command to check all the certificate list. One certificate is already there, be a default of master node, and the other one is from the agent node. On Agent Node Now run this command to test if the connection has been established between master and agent nodes, and everything is running fine.

Sample Puppet Example

Let’s run a simple puppet example. I will create a simple puppet manifest, which creates a directory with a certain permission. On the Master Node:  Put the below content. Now run the below command for an agent to reach out to master and pull the configurations. After running this command, it should create that directory on the agent node. On Agent Node Run the ls command to check if the director has been created successfully.  There you go! Conclusion This was a simple example to demonstrate its working. But imagine a bigger scenario, where you got to install or apply a certain configuration on hundreds of servers. Puppet can help you achieve it in minutes. If you are involved in automation and interested in learning more, you may check this Udemy course, which talks about Ansible, Puppet, and Salt.

How To Install Puppet 6 On Ubuntu 18  - 31How To Install Puppet 6 On Ubuntu 18  - 10How To Install Puppet 6 On Ubuntu 18  - 56How To Install Puppet 6 On Ubuntu 18  - 72How To Install Puppet 6 On Ubuntu 18  - 13How To Install Puppet 6 On Ubuntu 18  - 99