Puppet is an open-source, cross-platform, enterprise automation tool that manages and automates the configuration of servers. It is a useful tool for administrators since is capable to configure all computer systems via the network automatically, add users, install packages, and many more. Puppet is written in Ruby DSL language and follows client-server Mode. Join us to review the Tutorial Setup Puppet on Ubuntu 21.04. To find your considered package, visit Eldernode and purchase your own Ubuntu VPS Hosting service.
Table of Contents
How To Setup Puppet On Ubuntu 21.04
Previously, Puppet was introduced to you. You can use it to perform your administrative tasks and server management remotely. Puppet is available on Linux, Unix, and Windows. Puppet can be setup in a client-server model that has multiple modules, In this guide, we use Ubuntu 21.04 as our Puppet master or Puppet server.
Prerequisites to Install Puppet on Ubuntu 21.04
To let this tutorial work better, please consider the below Prerequisites:
_ A non-root user with Sudo privileges. To setup, follow our Initial server setup on Ubuntu 21.04.
_ Two or more (master and other clients) running Ubuntu 21.04 systems.
_ Connected systems with private or public networks.
Install Puppet Master and Agent on Ubuntu 21.04
Puppet uses a client-server model where Puppetmaster controls configuration information for Puppet agents. Let’s go through the required steps of installing Puppet on Ubuntu 21.04 and then get ready to configure and setup it.
Step 1:
As usual, start with updating all packages on Puppet master and Puppet client systems. Run the following command to update them:
apt-get update -y
Step 2:
Now, to let nodes communicate together by hostname, setup hostname on both nodes. To do this, edit /etc/hosts file on both node:
nano /etc/hosts
Then, add the following lines on both nodes:
puppet-master-ip puppetmaster puppet
puppet-client-ip puppetclient
When you are finished Save and Close the file.
Step 3:
By default, the Puppet package is not available in the Ubuntu 21.04 default repository. So, to install the Puppet server on the master node, you need to install the Puppet repository on your server. Use the command below to download the latest version of Puppet:
wget https://apt.puppetlabs.com/puppet6-release-focal.deb
After a successful download, run the following command to install it:
dpkg -i puppet6-release-focal.deb
When the installation is finished, run the following commands to update the repository and install the Puppet server:
apt-get update -y
apt-get install puppetserver -y
Step 4:
Now that you have installed the Puppet server successfully, change the Puppet Javaprocess memory allocation size. To do this, you need to edit /etc/default/puppetserver file:
nano /etc/default/puppetserver
When you are finished, Save and Close the file.
Step 5:
Now, you can start the Puppet service and enable it to start at system reboot. So, run:
systemctl start puppetserver
systemctl enable puppetserver
Step 6:
In this step, you can verify the status of the Puppet service by running the command below:
systemctl status puppetserver
How to Install and Configure Puppet Agent
Now that the Puppet server is installed, you can install the puppet agent on the client node.
First, use the commands below to download and install the Puppet repository:
wget https://apt.puppetlabs.com/puppet6-release-focal.deb
dpkg -i puppet6-release-focal.deb
After installing the repository above, run the commands below to install the Puppet agent:
apt-get update -y
apt-get install puppet-agent -y
Once the Puppet agent is installed, open the Puppet configuration file to edit it:
nano /etc/puppetlabs/puppet/puppet.conf
Then, add the following line to define the Puppet master information:
[main] certname = puppetclient server = puppetmaster
Note: Make sure these hostnames are defined in the /etc/hosts file on the client.
Then, you can Save and Close the file.
Now, run the commands below to stop, start and enable the Puppet agent to automatically start up when the client boots:
sudo systemctl stop puppet
systemctl start puppet
systemctl enable puppet
Also, to verify the status of the Puppet, run the following command:
systemctl status puppet
In this way, the Puppet agent is installed and configured.
How to Sign Puppet Agent Certificate
Since the Puppe uses a client-server architecture, you should approve a certificate request for each agent node before it can configure it. In this section, switch back to back to the server node. To list all available certificates on the server, run the command below:
/opt/puppetlabs/bin/puppetserver ca list
And then, to sign all the certificate, run the following command:
/opt/puppetlabs/bin/puppetserver ca sign --all
Once you get the “Successfully signed certificate request for puppet client” and ”Successfully signed certificate request for puppetmaster” in the output, it means that the Puppet master can able to communicate and control the agent node.
Finally, use the command below to test the Puppet master and agent communication on the Puppet agent node:
/opt/puppetlabs/bin/puppet agent --test
Conclusion
In this article, you learned How to Setup Puppet On Ubuntu 21.04. To do this, you first learned to install Puppet Master and Agent. Next, you reviewed the installation and Configuration of Puppet Agent. Finally, by Signing Puppet Agent Certificate, you have successfully finished this guide. So, you will be able to add multiple agents and manage them easily with Puppet. Send us feedback while using this tool to help your friends use your new experience on Community.