Puppet and Foreman : infrastructure as legos


It’s been a while since I posted my last article. I’ve began writing this article 6 months ago when I wanted to prepare a simple introduction to Puppet and Foreman for all the curious people at my workplace.

We’ve been very busy with other subjects recently and I gave up on the subject… but I’ve recently decided to finish it because I hate things left undone !

The idea is to give an introduction to Puppet and Foreman (and especially Foreman and how to manage a set of server with it) using a simple analogy: you can build your servers as if you were building constructs with Legos.

Everybody has played with Legos, right? Time to play again !

Infrastructure as legos

First, let’s define what we are trying to achieve here.

We need to manage our server infrastructure. In our context, we’ll compare a server (either physical or virtual) with a Lego model, such as this car below.


What we want is:

  • Produce as many of these models as we need
  • Customize these models attributes (colours, number of wheels…)

To resume, we want to provision & configure our servers.


Let’s recap what is Puppet first. As stated on their website:

Puppet is a configuration management system that allows you to define the state of your IT infrastructure, then automatically enforces the correct state.

It is a tool that will help you automate your infrastructure management and sysadmin tasks.

In order to start with the Lego comparison, Puppet is the open-source Lego company, providing schematics to create your own block blueprints. It also provides you a workshop where you can share and retrieve blueprints created by other people: the Puppet forge.

The Foreman

The Foreman is a tool that can manage your servers lifecycle from creation, configuration, to destruction. In this analogy, it will be used in two different ways:

  1. Our blueprints catalog, as the Puppet ENC (what is an ENC?)
  2. Our model factory, as our provisioning system

Puppet module

A puppet class should be defined as a simple Lego block, it should do one thing and do it well ! They can have different shapes, color, sizes…


Foreman configuration group

A foreman configuration group is a logical group of Puppet classes. It is not tied to an environment, so you can group in there any classes. I tend to see it as a logical block group to build my hostgroups / nodes.


Puppet environment

A Puppet environment is a set of Lego blocks available for the creation of configuration groups, hostgroups and nodes ! It is a list of classes in a defined state.


Foreman hostgroup

A Foreman hostgroup is a container for multiple Puppet modules and/or configuration groups.

A hostgroup is a model structure that will be used by your Foreman nodes as their base. Note that you can nest hostgroups to inherit from previously defined structures.


Foreman node

This is it, this is our server. At this point, we have the base structure and we can add other blocks and choose their colors (by specifying parameter values).

A foreman node is a server. In the Lego way, it is the final structure you want to create using available blocks inside a specific environment, a hostgroup as the base structure and any configuration groups.


Have fun !


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s