Puppet Cheat Sheet
Reference for Puppet manifest syntax, resource declarations, classes, modules, and common puppet CLI commands.
2 PagesAdvancedFeb 2, 2026
Basic Manifest
A manifest installing, configuring, and running nginx.
puppet
package { 'nginx': ensure => installed,}file { '/etc/nginx/nginx.conf': ensure => file, content => template('nginx/nginx.conf.erb'), owner => 'root', mode => '0644', require => Package['nginx'], notify => Service['nginx'],}service { 'nginx': ensure => running, enable => true,}
Class Definition
Defining a reusable class with parameters.
puppet
class nginx ( String $port = '80', Boolean $enable_ssl = false,) { package { 'nginx': ensure => installed, } service { 'nginx': ensure => running, enable => true, require => Package['nginx'], }}# Usage in site.ppnode 'web1.example.com' { class { 'nginx': port => '8080', }}
Core Resource Types
Common built-in Puppet resource types.
- package- Manages package installation state (installed, absent, latest)
- file- Manages file/directory content, ownership, and permissions
- service- Manages service running/enabled state
- user / group- Manages user accounts and group membership
- exec- Runs arbitrary commands, ideally guarded with onlyif/unless/creates
- cron- Manages cron job entries
Puppet CLI
Common commands for applying and managing Puppet.
bash
puppet apply site.pp # Apply manifest locallypuppet apply --noop site.pp # Dry run, show changes onlypuppet agent -t # Trigger a run against Puppet Serverpuppet module install puppetlabs-nginxpuppet parser validate site.pp # Syntax check
Pro Tip
Always run 'puppet apply --noop' (or agent -t --noop) before rolling out manifest changes fleet-wide — it reports exactly which resources would change without touching the system.
Was this cheat sheet helpful?
Explore Topics
#Puppet#PuppetCheatSheet#DevOps#Advanced#BasicManifest#ClassDefinition#CoreResourceTypes#PuppetCLI#OOP#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance