Puppet Tutorials
  • Share this blog:



Puppet is used to automate several routine sysadmin configuration tasks.

Puppet in an enterprise-grade configuration management system.

It allows you to define the state of your IT infrastructure. Once it is defined, Puppet will automatically enforce the correct state on an on-going basis.

Managing software states on hundreds of thousands of servers can be a real challenge. What web server should be installed? What web server configuration should look like? Which users should have access to certain machines or groups of machines? Now multiply those questions and many more by the number of servers you have and you end up in total madness.

Fortunately, the year is 2014+ so welcome to the world where tools for various automation are all over the open-source world and different people use different sets depending on their needs, use case, and environmental requirements.

Puppet configuration management tool

Puppet consists of a language, client-server processes, and the Resource Abstraction Layer.

The language allows the description of a server configuration with an abstraction of the resources that an administrator already thinks in: users, groups, packages, files, cron, mount, and services, to name a few.

The relationship between the resources is also specified. For example, service depends on a configuration file, and that file depends on a package being installed. The relationships provide order as the policy is applied and allows Puppet to restart dependent services when their configurations change.

Inclined to build a profession as Puppet Developer? Then here is the blog post on, explore Puppet Training

The resources can also be composed of logical collections. To reuse the previous example, a package, a configuration file, and a service can be grouped together. The group can then be reused and treated as a single logical entity in other Puppet code. The client-server setup provides a secure mechanism for transporting the specific configurations from the central description to the individual hosts over HTTP with SSL authentication and encryption -- the same SSL used to secure online banking and e-commerce. Each host only receives its specifically compiled configuration to apply.

Configurations are audited and applied by querying the current state, comparing the results with the desired state, and taking the appropriate action for each resource. Applying the configuration will take a base install an operating system to a fully configured server. Changes to the central policy can also update configuration files or apply patches. The cycle of auditing and syncing systems with the assigned policy is then used to manage systems throughout the system lifecycle.

The auditing and syncing cycle can ensure consistency across the entire network. With traditional tools and techniques, the chance that two machines providing the same service are configured the same is quite small. As the server counts climb, inconsistencies created by configuration drift cause confusion and mistakes.

Meet Puppet. A software framework that allows you to easily make rapid changes across your infrastructure and enforce consistency with minimal efforts in four simple steps.

  • Define what the final state of your machines and groups of machines should look like with simple rules
  • Simulate enforcement of the rules to see how it goes
  • Enforce the rules so the machine can enter the desired software state
  • Receive reports about the changes, run time, etc.

So how to get started with it so it can make your operations live easier? Well, we should know how its basics work first, so we can take proper decisions and avoid wrong ones bite us later.

  • Puppet runs/executes the so-called manifests files (recipes). Think of them as simple programs.
  • Manifest files describe the final stage of the system with clear, easy to use and understand syntax.
  • A Group of manifest files is called modules
  • Puppet has a set of functions you can use to make your life easier
  • Puppet is cool so it offers you the functionality to write your own custom functions, classes, and facts.

Puppet packages should be available for most major distros already. Just search for a puppet using your package manager of choice. For example, on Ubuntu 10.04 you'd want puppet and puppet-common for the managed systems, and puppet master for the central server (if you have multiple systems). You might also want the vim-puppet package if you'll be writing Puppet manifests in Vim, or puppet-el if you want to write manifests in GNU Emacs.

When you're working with Puppet, you're working with resources. Users, packages, files, services, etc. A resource describes something on your system. You can find the standard types on the language resource guide on Puppet Labs' site. Some resources are standard across all OSes (like files) others are OS-dependent (like zfs and zone, which are Solaris-only).

For single systems, you'll usually use puppet to execute a manifest. Remember, a manifest is a file containing a set of resources and instructions on how that resource should be configured or manipulated.

Puppet also has a shell that you can use to execute Puppet commands and configure a local system. The Resource Abstraction Layer Shell (ralsh) can list resources, and operate on resources. Here's a simple example to verify whether a user exists on the system using ralsh:

ralsh user norm

If the norm doesn't exist as a user account on the system yet, you'll see this:

user { 'norm':
    ensure => 'absent'

This is Puppet providing the current system configuration, as expressed in the Puppet language. This is how you'd write a manifest to remove the username from a system. What if we want to add the norm as a user with a rash? Easy:

ralsh user norm

Ridiculously easy, isn't it? That will create a norm with some sane defaults. Here's the manifest that rash executes:

user { 'norm':
    uid => '1001',
    ensure => 'present',
    gid => '1001',
    home => '/home/norm',
    shell => '/bin/sh'

You'd write that up as a manifest and run it using puppet on your local system. What if we want to make the norm's shell bash instead of sh? Let's look at that as a manifest:

user { 'norm':
    uid => '1001',
    ensure => 'present',
    gid => '1001',
    home => '/home/norm',
    shell => '/bin/sh'

Copy that to a file, like norm.pp, and change the shell line to shell => '/bin/sh'. Then run puppet norm.pp. Puppet will check the user, and make the changes necessary so that the user conforms to the manifest.


Puppet Interview Questions

Features of Puppet

  • Designed in such a way that it prevents duplication for everyone solving the same problem.
  • Mature Tool
  • Powerful Framework
  • Simplify System Administrator’s Technical Task.
  • The System Administrator’s task is written in Puppet’s Native code and can be shared.
  • Makes it possible to make rapid and repeatable changes automatically.
  • Maintains System Consistency and Integrity.
  • Helpful in managing Physical and Virtual devices as well as the cloud.

Advantages of puppet over other tools

Normally most of the configuration management tool, deploy the required configuration on a machine and leave them as it is. But the puppet keeps on verifying the configuration at a specified interval(which you can modify as per requirement).

Puppet defines the configurations for a host with the help of a language that is very easy to learn and is only used for that purpose.

Puppet is used by major players in the industry like Google, red hat, etc.

Larger open-source developer base

A wide number of platforms are supported in puppet.

Its works very smooth, even when deployed in a large infrastructure(thousands of hosts to manage)


The puppet automation tool seems robust, user-friendly interface, as well as very declarative. Installation was very easy for me it was nothing to worry about dependencies at installation.

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses


About Author
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox