Developed by Puppet Lans, Puppet is an open-source configuration administration software used for automating and centralizing the configuration of infrastructure comparable to servers identical to Ansible and Chef. It helps the easy execution of repetitive duties which might in any other case be cumbersome and time-consuming.
Puppet adopts a client-server structure and includes the next salient features.
- Puppet Grasp/Server – This node incorporates all of the configuration required to handle shopper nodes on which the puppet slave is put in.
- Puppet Slave – These are the managed shopper nodes in your surroundings. All slaves are managed by the Puppet grasp and have the Puppet agent put in and working.
- PuppetDB – It is a database that shops all the information generated by Puppet.
On this information, we’ll display how one can set up Puppet Grasp and Agent in RHEL-based distributions comparable to CentOS, Fedora, Rocky, and AlmaLinux.
Lab Setting Setup
Puppet Grasp Node with IP 139.144.20.170 - Rocky Linux 8 Puppet Slave with IP 45.79.206.178 - Ubuntu 22.04
Step 1: Configure Hostname in Puppet Grasp and Slave
To get off the bottom, log into your system and improve the software program packages utilizing the dnf command as follows.
$ sudo dnf replace -y
Subsequent, configure a hostname on your nodes, which might be beneficial alongside the best way as you arrange Puppet in your system.
For Puppet Grasp
$ sudo hostnamectl set-hostname puppetmaster.tecmint.com
For Puppet Slave
$ sudo hostnamectl set-hostname puppet-agent
Affirm the brand new hostname utilizing the hostnamectl command:
$ hostnamectl
Subsequent, replace the /and so on/hosts file for each techniques with the hostname and DNS information as proven.
Swap to the foundation person.
$ su -
Subsequent, replace the /and so on/hosts file with the IP handle and hostname or FQDN of your system.
For Puppet Grasp
# echo "139.144.20.170 puppetmaster.tecmint.com" >> /and so on/hosts
For Puppet Slave
# echo "45.79.206.178 puppet-agent" >> /and so on/hosts
As soon as the hostnames and DNS information have been arrange, proceed with the subsequent step.
Step 2: Add Puppet Repository on Puppet Grasp (Rocky Linux)
To put in Puppet, we have to add its repository to the system. To take action, run the next command.
$ sudo dnf set up https://yum.puppet.com/puppet-release-el-8.noarch.rpm -y
To verify that the repository has been efficiently added, run the rpm command:
$ rpm -qi puppet-release
As well as, guarantee to additionally add the EPEL repository as proven.
$ sudo dnf set up https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
Subsequent, allow the Powertools repository which gives developer instruments and libraries. The repository additionally gives a bunch of packages which can be wanted as dependencies when putting in different purposes.
$ sudo dnf config-manager --set-enabled powertools
To make sure the cache is absolutely updated with all metadata in place, construct the cache as proven.
$ sudo dnf makecache
Step 3: Set up Puppet on Puppet Grasp (Rocky Linux)
Prior to installing Puppet, make sure that all of the required repositories have been enabled as follows.
$ sudo dnf repolist
Subsequent, set up Puppet Server as follows.
$ sudo dnf set up puppetserver -y
The command installs a bunch of packages together with Pupper Server and Agent, Java OpenJDK, Lua, NSS, and plenty of extra. Beneath is the command output.
To verify that the Pupper Server has been put in, run the command:
$ rpm -qi puppetserver
The command prints out detailed info comparable to identify, model, launch, structure and set up date to say a couple of.
Step 4: Configure Puppet Grasp Server (Rocky Linux)
As soon as Puppet Server is put in, the subsequent step is to configure it. Subsequently, entry the primary configuration file for Puppet as proven.
$ sudo vim /and so on/puppetlabs/puppet/puppet.conf
Underneath the [server]
part add the DNS entry as proven.
dns_alt_names=puppetmaster.tecmint.com,puppetmaster,puppetserver
As well as, add the [main]
part as follows, the place puppetmaster.tecmint.com is the FQDN or hostname of your puppet server.
[main] certname = puppetmaster.tecmint.com server = puppetmaster.tecmint.com surroundings = manufacturing runinterval = 1h
That is what our configuration appears like.
Save the modifications and exit the configuration file.
Step 5: Configure JVM Reminiscence Allocation (Elective)
By default, 2GB of JAVA reminiscence is allotted to Puppet Grasp Server. In case your system doesn’t have adequate reminiscence, you may edit the server configuration file and assign a decrease worth comparable to 1GB.
Subsequently, entry the configuration file.
$ sudo vim /and so on/sysconfig/puppetserver
Find these arguments: -Xms2g -Xmx2g
and alter 2g to 1g (means 1GB).
Save the modifications and exit the configuration file.
Step 6: Begin and Allow Puppet Server
After making all of the required modifications, begin the Puppet Server service as proven.
$ sudo systemctl begin puppetserver
Then allow the service to start out on boot time or system startup.
$ sudo systemctl allow puppetserver
To confirm that the Puppet server is working, execute the command:
$ sudo systemctl standing puppetserver
The next output confirms that the Puppet server is working.
Step 7: Begin and Allow Puppet Agent
The set up of Puppet Server additionally installs the agent as properly. Nevertheless, the agent doesn’t begin routinely, and it’s essential to do it manually.
To begin the puppet agent, run the command.
$ sudo systemctl begin puppet
Additionally, take into account enabling the agent to start out on boot.
$ sudo systemctl allow puppet
Now, confirm if the agent is lively and working by working the next command.
$ sudo systemctl standing puppet
Step 8: Enable Puppet Service in Firewall
One other factor it’s essential take into account is to permit the Puppet service throughout the firewall in order that the server might be accessed over the community.
To take action, run the next instructions.
$ sudo firewall-cmd --add-service=puppetmaster --permanent $ sudo firewall-cmd --reload
Step 9: Add Puppet Binary Folder to $PATH
Puppet binaries are positioned in /decide/puppetlabs/bin. On the time of scripting this information, the listing is already positioned within the $PATH.
To verify this, run the printenv command as proven.
$ printenv | grep puppetlabs
You may as well confirm that as proven.
$ which puppet /decide/puppetlabs/bin/puppet
If for some motive Puppet isn’t added to $PATH, change to the foundation person
$ su -
Then run the next instructions so as to add it to $PATH.
# echo 'export PATH=$PATH:/decide/puppetlabs/bin' | tee -a ~/.bashrc # supply ~/.bashrc
Step 10: Confirm Puppet Server Utilizing Puppet Shopper
To verify that the Puppet server is working as anticipated, run the command:
$ sudo /decide/puppetlabs/bin/puppet agent --test --ca_server=puppetmaster.tecmint.com
The next output confirms that every one appears good.
You may as well obtain the identical as the foundation person as proven
# puppet agent -t
To view accessible certificates on the Puppet Grasp node, execute the next command.
$ sudo /decide/puppetlabs/bin/puppetserver ca checklist --all
Thus far, we have now managed to put in Puppet Server and Agent on the Grasp node. If that is what you have been in search of, then you might be performed and dusted.
Nevertheless, we talked about that Puppet works in a client-server structure. Within the following step, we’ll display how one can set up and configure the Puppet agent on the shopper node.
Step 11: Set up and Configure Puppet Agent on Slave
On this part, we’ll set up Puppet Agent on a Ubuntu Slave node after which set up communication between the Pupper Grasp node and the Shopper.
For Ubuntu 22.04
$ wget https://apt.puppetlabs.com/puppet7-release-jammy.deb $ sudo dpkg -i puppet7-release-jammy.deb $ sudo apt replace $ sudo apt set up puppet-agent -y
For Ubuntu 20.04
$ wget https://apt.puppet.com/puppet7-release-focal.deb $ sudo dpkg -i puppet7-release-focal.deb $ sudo apt replace $ sudo apt set up puppet-agent -y
As soon as put in, entry the agent’s configuration file.
$ sudo vim /and so on/puppetlabs/puppet/puppet.conf
Add the next part.
[main] server = puppetmaster.tecmint.com
Save the modifications and exit.
To use the modifications, restart the Puppet agent service.
$ sudo systemctl restart puppet $ sudo systemctl allow puppet
Step 12: Join Puppet Agent to Puppet Server
The final step is to ascertain a connection between the Puppet server and the agent put in on the shopper system. To do that, entry the shopper node and generate certificates for the Pupper grasp to signal.
$ sudo /decide/puppetlabs/bin/puppet agent -t
You’re going to get a notification that the certificates has not been signed but.
Head over to the Pupper grasp node and checklist the certificates which can be pending to be signed. Right here, the certificates is listed as puppet-agent.members.linode.com.
$ sudo /decide/puppetlabs/bin/puppetserver ca checklist
Now signal the certificates utilizing the next command:
$ sudo /decide/puppetlabs/bin/puppetserver ca signal --certname puppet-agent.members.linode.com
Lastly, head again to the Shopper node and signal the certificates.
$ sudo /decide/puppetlabs/bin/puppet agent -t
Conclusion
This brings us to the tip of this information. On this article, we have now demonstrated how one can set up Puppet Grasp and Agent on RHEL-based techniques utilizing Rocky Linux 8 nodes in our setup.