Some days ago a guy asked me why I do not blog anything on Puppet configuration management tool and prefer Ansible over Puppet. True it is that I prefer Ansible because it is agentless and very easy to use. However, we agreed that there are certain situations that Puppet wins over Ansible. I decided to blog about this configuration management tool so as to enhance my knowledge and that of my readers. Puppet provides several services such as Windows automation, cloud management, configuration management, etc. However, in this blog post, we will talk about puppet as a configuration management tool. Puppet provides the ability to define which software and configuration a system requires and then maintain a specified state after the initial setup. The nodes that Puppet control must have the Puppet agent installed. In this blog post, we will focus on the installation of the Puppet Server and the Agent as well.
1. For that, I created two VMs (puppet-server and puppet-client) on my Virtual Box labs which are Puppet-Server and Pupper-Client. I have also mentioned each hostname and IP Address in the /etc/hosts file of each server.
2. You can get the repository on yum.puppetlabs.com. I downloaded it with the following commands on both servers:
rpm -Uvh https://yum.puppetlabs.com/puppet-release-el-7.noarch.rpm
3. On the puppet-server, install the puppet-server package.
yum install puppetserver
4. Since I am on a virtual machine with very low memory assigned, I tweak the memory Xms and Xmx value (heap size). The Xms is the initial minimum heap size when the service start whilst the Xmx is the maximum heap size. On the puppet-server, I edited the file /etc/sysconfig/puppetserver and change the heap value to this:
JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
5. Add the puppet binary to your environment. I edited the bash_profile file for that.
Also launched the following command:
6. Also, install the puppet-agent on the puppetclient machine.
yum install puppet-agent -y
7. On the puppetserver, you can start the service with the following command:
systemctl start puppetserver
8. And, on the puppetclient you can start the service as follows:
systemctl start puppet
9. Now, that we have seen how to install the Puppet server and the agent. Let's now see other directories related to Puppet.
- /etc/puppetlabs/puppet - contain several configuration files
- /etc/puppetlabs/puppet/ssl - contain the certificate
- /etc/sysconfig/puppetserver - file that contain the java configuration such as heap size, start timeout etc.
- /etc/puppetlabs/code/environments/production - Default production environment available to write the codes.
puppet resource --type11. To understand the syntax of the resource, for example, the resource 'file', use the following command:
puppet describe fileIn the next article, I will describe how to use the Puppet configuration management tool to administer or to instruct the puppet agent to perform specific tasks. Remember, Puppet file extension ends with '.pp' and I will focus a lot more on that. At the same time, this is a good way to refresh my memory when using Puppet. I hope you liked this article when it comes to the basic installation and configuration when using Puppet.