What is Puppet

W

Running a correct configuration on any system is extremely important. Regardless of their role, it is vital that each system is configured correctly to produce good results.

The classical approach consists in the development of scripts and the use of configuration files to ensure the proper functioning of the systems. As we add more services to software, scripts can become more complex and interdependent, and this makes them harder to coordinate. Adding a new functionality or debugging a script that does not work will take up more and more time. The same is true when other systems are added. There is a need for centralized management, monitoring, and reporting system.

Here are the best configuration management tools. All are based on 2 major ideas. First of all, we need to have a declarative language that describes exactly where we want the system to be, in a uniform way. In other words, we will say where we want to get, not how we get there. We set a destination and the program we use deals with the moving arrangements. Second, we need centralized management. A master will be responsible for monitoring the system and implementing the correct configuration if required.

Puppet
Puppet is a solution whose popularity increases due to the flexibility and ease with which it can be learned. It is written in the Ruby language and has its own declarative language. This solution is based on resources and manifests. Understanding these two concepts helps you discover the philosophy behind Puppet.

1. Resources
Almost every aspect of a system – files, users, packages, services – is seen as a resource. This means that the description of a resource is separate from its implementation. This is achieved by modeling the states that a resource can have.
Even though different Linux distributions have different ways to start a service, this does not matter here. The Puppet solution deals with all the aspects of the backend. Moreover, we can use the same command on different operating systems such as Linux and Windows, for example. To list all the resources that Puppet can take over, we can use the puppet describe command. To inspect the specific attributes that a resource type may have, we can use this command: puppet describe service.

2. Manifesto
If we want persistent configurations, we need to store the resource definitions in manifest files. These contain written definitions using Puppet’s declarative language, with a syntax similar to that of Ruby. We do not have to list all the possible attributes for a resource. Each attribute has a default value that will be used if we do not want to declare anything specifically.
The manifesto can be executed by the puppet apply command. In case the manifesto is saved to a file called testing.pp, we will run puppet apply testing.pp. Or we can use Puppet to run it periodically, assuring us that the user is always present.

3. Evolution
We can also use Puppet for more complex scenarios. Resources can depend on one another and can be set up with templates. We can also generate reports that we can view using a web dashboard.
Another useful feature of Puppet is that we can use templates. Using the ERB language, puppet provides the ability to generate files according to the parameters provided by the administrator to the instance of the class or the state of the system, using fact sheets. Together with puppet, a utility called facter is installed on the system. It gathers system information and exposes them as facts (IP, FQDN, OS). This functionality can be extended with administrator rights which in turn can be used in templates.

Another possibility to extend puppet usage is by using the puppet dashboard. This service provides a web interface that gives us more information and infrastructure statistics. First, each client sends to the server running a puppet dashboard a report about the last run customer such as if everything went smooth or if something failed. We can view these in-app reports as well as statistics generated from these reports.

Also, the puppet dashboard offers a service called Inventory Service through which we can query the state of the system, depending on the facts. If using PuppetDB we can use this information inside classes, and by using Inventory Service, we have access to them from the outside. Using their APIs, we can build tools/applications to use this information.
The flexibility through which it can be used and the potential it has to ease the developers’ work make it a very useful tool that today has a growing user base.

About the author

Ilias spiros
By Ilias spiros

Recent Posts

Archives

Categories