Exclusive to Pro subscribers, not available for the Free-Week
Infrastructure as Code

Puppet Playground

Get access to the puppet playground in 1 click

Why use Puppet?

It's easy to configure a couple of servers manually. But it would be a nightmare to do that with hundreds or thousands of servers. That's why we have tools like Puppet.

Puppet can automatically configure any number of systems. We just need to declare the state we desire for those systems. And we do that with the help of Puppet DSL (Domain-Specific Language), also sometimes called "Puppet code".

How Does Puppet Work?

Some languages are procedural, but Puppet code is declarative. In a procedural language, we describe "steps that need to be followed" to get to a final state. In declarative languages, we just specify the final state we desire. Otherwise said, we don't tell Puppet how to get to that final state. It figures out all the necessary steps on its own.

What's so cool about this? Well imagine we need an identical final state for 2 systems. But system1 and system2 are currently in two different states. A procedural approach would take the same steps on both systems, which may lead to inconsistent results. But Puppet, due to its declarative nature, can intelligently adapt. It will notice these two systems are configured differently. So it will take one set of actions on system1, and a different set of actions on system2. In the end, both system1 and system2 will be in an identical final state.

How does Puppet work?

Puppet uses a server-agent architecture. 

  1. The Puppet server is responsible for storing the configuration information of the agent nodes. 
  2. Facter is a tool that retrieves facts about the agent nodes such as IP address, hostname, etc. It is similar to the env command that we use to list the environment variables. These facts are maintained as key-value pairs. 
  3. The agent nodes send these facts to the Puppet server in the form of manifests. Manifests contain the code that describes the desired state of the nodes. 
  4. The server uses these manifests to create a catalog for the agent node. 
  5. The agent node will request its individual catalog from the Puppet server. 
  6. It will enforce those configurations on the server ultimately achieving the desired state.

The Puppet playground will provide you with all the necessary prerequisites to run Puppet code.