"It's not programming, it's declaring your intentions to the universe. The universe just happens to be made of servers."
The Puppet language (also called the Puppet DSL) is a declarative, domain-specific language designed for one thing: describing the desired state of your infrastructure. You don't tell Puppet how to do something β you tell it what you want, and it figures out the rest.
If you're coming from shell scripting or Python, this requires a small shift in thinking. Instead of writing:
# Imperative (shell): HOW to do it
if ! rpm -q httpd; then
yum install -y httpd
fi
systemctl enable httpd
systemctl start httpdYou write:
# Declarative (Puppet): WHAT you want
package { 'httpd':
ensure => installed,
}
service { 'httpd':
ensure => running,
enable => true,
}Same result, but the Puppet version is idempotent, cross-platform (mostly), and self-documenting. Let's dive in.
Each topic has its own page with detailed explanations and copy-pasteable examples.
| # | Topic | Description |
|---|---|---|
| 1 | Resources | The fundamental building blocks β types, titles, and namevars |
| 2 | Resource Types Reference | file, package, service, user, group, cron, exec β with examples |
| 3 | Variables & Data Types | Variables, facts, scope, type system, and parameter validation |
| 4 | Strings, Arrays & Hashes | String interpolation, heredocs, arrays, hashes, and nested access |
| # | Topic | Description |
|---|---|---|
| 5 | Conditionals | if/elsif/else, case statements, and selectors |
| 6 | Classes | Defining, declaring, and parameterizing classes |
| 7 | Defined Types | Reusable resource templates β instantiate multiple times |
| 8 | Relationships & Ordering | Arrow notation, metaparameters, and chaining |
| 9 | Iteration | each, map, filter, and reduce |
| # | Topic | Description |
|---|---|---|
| 10 | Functions | Built-in functions for strings, arrays, hashes, and lookups |
| 11 | Templates | EPP (preferred) and ERB templates for dynamic file content |
| 12 | Node Definitions | Assigning code to specific nodes in site.pp |
| 13 | Regular Expressions | Ruby-style regex matching, capture groups, and case statements |
| # | Topic | Description |
|---|---|---|
| 14 | Real-World Example | A complete NTP module using everything you've learned |
Next up: CLI Reference β
This document was created with the assistance of AI (Grok, xAI). All technical content has been reviewed and verified by human contributors.