Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 38 ยท Getting Started

What Is Puppet?

Learn what Puppet is, what problem configuration management solves, how Puppet describes servers in code, and what you will build in this course.

Puppet is a configuration management tool. You write a description of how a server should look: which packages are installed, which files exist, which services run, which users are present. Puppet then makes each server match that description and keeps it that way. If someone changes a file by hand next week, Puppet notices on its next run and puts it back.

Before tools like this, administrators set up servers by logging in and typing commands, or by running shell scripts. That works for one machine. It falls apart at ten, and it is impossible at a thousand: servers drift apart, nobody remembers what was changed, and rebuilding a broken machine means guessing. Puppet turns server setup into code you can review, test and store in Git.

Puppet cannot run on this site because it needs real servers. The lessons describe commands and files precisely, and the runnable examples are small Python stand-ins that imitate the ideas (comparing desired and actual state, building a catalog). They are labelled as stand-ins every time. Real Puppet output is shown only where it is well known and stable.

The problem Puppet solves

Imagine you run three web servers. Each needs nginx, a configuration file, a deploy user and a firewall rule. Done by hand you will eventually forget a step on one machine. Then a bug appears only on that server, and you spend an afternoon finding out why.

Configuration management solves four problems at once:

  • Repeatability. The same code gives the same server every time.
  • Consistency. All machines of one kind are alike, so a bug reproduces everywhere.
  • Documentation. The code is the truth about how a server is set up.
  • Recovery. A destroyed server is rebuilt by pointing a new machine at the same code.

Why configuration management?

Repeatable Same code, same server
Consistent No drift between machines
Documented The code is the truth
Recoverable Rebuild in minutes

Puppet gives you all four.

1 / 2

Desired state, in Puppet code

Puppet code lives in files called manifests (extension .pp) and is written in the Puppet language. Here is a complete example:

PUPPET
package { 'nginx':
  ensure => installed,
}

file { '/etc/motd':
  ensure  => file,
  content => "Managed by Puppet. Do not edit by hand.\n",
}

service { 'nginx':
  ensure  => running,
  enable  => true,
  require => Package['nginx'],
}

Read it as three statements about the end result: the package nginx is installed, the file /etc/motd exists with this content, and the service nginx is running and starts at boot. Nothing says how. Puppet knows how to install a package on Debian (apt), on Red Hat (dnf) or on Windows, and picks the right method for each machine. The require line is the only ordering hint: install the package before starting the service.

Each block is a resource: a type (package), a title ('nginx') and attributes (ensure => installed). Resources are the building blocks of everything in Puppet, and Resources and Resource Types covers them in depth.

Declarative, not step by step

A shell script says "run apt install nginx". Run it twice and you may get an error, or a surprise upgrade. Puppet code says "nginx must be installed". Run it twice and the second run does nothing, because the goal is already reached. That property is called idempotence, and the next lesson explores it with a runnable model.

The Puppet world at a glance

flowchart LR
    A["Your code<br/>manifests, modules, Hiera"] --> B["Puppet Server<br/>compiles a catalog"]
    B --> C["Agent on each node<br/>applies the catalog"]
    C --> D["Report back<br/>changed / unchanged / failed"]
    D --> B

The core loop: code goes to the server, the server compiles one catalog per node, the agent enforces it and reports.

You can also skip the server and run puppet apply on a single machine. Most people start there (First Puppet Run), then move to a server and agents (Puppet Architecture).

A stand-in: desired state versus actual state

The heart of Puppet is a comparison. This stand-in (plain Python, not Puppet) models a server as a dictionary and a "manifest" as the desired state, then lists what would change.

Python Stand-in: what would Puppet change?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Change one desired value so it equals actual and rerun: the change list shrinks. A real agent does exactly this for every resource, using real tools to read the actual state.

Puppet in the wider world

Puppet was created by Luke Kanies, first released in 2005, and is one of the oldest tools in the field. Its main characteristics:

  • Declarative language with its own syntax, compared with Ansible's YAML playbooks or Chef's Ruby.
  • Agent-based by default: a small program runs on every node and pulls its catalog on a schedule (every 30 minutes by default).
  • Strong reporting and modelling: every run records what changed, which is valuable for audits.
  • A large module ecosystem on the Puppet Forge.
  • Open source core. Puppet is open source; Perforce (which owns Puppet) offers commercial products on top, and a community fork named OpenVox exists. The language and concepts in this course apply to both.

The comparison lesson places Puppet next to its alternatives.

What you will learn

This course walks from first principles to production practice:

  1. Getting started: concepts, the language, a first run.
  2. Architecture and setup: server, agent, certificates, environments.
  3. Manifests and resources: the language itself.
  4. Classes, modules and Hiera: reusable code and separated data.
  5. Facts and templates, roles and profiles, testing and code management, scale and operations, and finished projects.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a Puppet manifest describe?

    Puppet is declarative: you state what should be true, and Puppet works out the steps.
  2. 2. Which is NOT a benefit of configuration management?

    Configuration management makes changes safer and reviewable, but code still needs testing.
  3. 3. What file extension do Puppet manifests use?

    Manifests are .pp files written in the Puppet language.
  4. 4. How often does a Puppet agent check in by default?

    The default runinterval is 30 minutes.

Summary

  • Puppet keeps servers in a desired state that you write as code.
  • Code lives in .pp manifests made of resources (type, title, attributes).
  • The language is declarative: you say what, not how.
  • A server compiles a catalog per node and an agent enforces it, then reports.
  • This course uses clearly labelled Python stand-ins because Puppet itself cannot run here.

Next: Declarative, Idempotent, and Puppet Compared