Puppet Cheatsheet
#
Puppet is an open-source configuration management tool that allows you to define the state of your IT infrastructure using a declarative language. Puppet automates the process of managing infrastructure, including software installation, configuration management, and more.
Puppet Basics
#
Command/Option | Example | Description |
---|
puppet –version | puppet --version | Display the version of Puppet installed |
puppet apply | puppet apply manifest.pp | Apply a Puppet manifest locally |
puppet agent -t | puppet agent -t | Run the Puppet agent manually on the node |
Puppet Agent
#
Command/Option | Example | Description |
---|
puppet agent –enable | puppet agent --enable | Enable the Puppet agent |
puppet agent –disable | puppet agent --disable | Disable the Puppet agent |
puppet agent –test | puppet agent --test | Run the Puppet agent in test mode |
Puppet Server Management
#
Command/Option | Example | Description |
---|
puppetserver start | puppetserver start | Start the Puppet server |
puppetserver stop | puppetserver stop | Stop the Puppet server |
puppetserver reload | puppetserver reload | Reload the Puppet server configuration |
puppetserver ca list | puppetserver ca list --all | List all certificate signing requests |
Puppet Modules
#
Command/Option | Example | Description |
---|
puppet module generate | puppet module generate username-modulename | Generate a new module skeleton |
puppet module install | puppet module install puppetlabs-apache | Install a module from the Puppet Forge |
puppet module list | puppet module list | List all installed modules |
puppet module uninstall | puppet module uninstall puppetlabs-apache | Uninstall a module |
Puppet Resource
#
Command/Option | Example | Description |
---|
puppet resource user | puppet resource user | Display the current state of user resources |
puppet resource service | puppet resource service | Display the current state of service resources |
puppet resource package | puppet resource package | Display the current state of package resources |
Hiera
#
Command/Option | Example | Description |
---|
hiera lookup | hiera lookup key | Lookup data in Hiera |
hiera config | hiera config | Display the current Hiera configuration |
Fact Management
#
Command/Option | Example | Description |
---|
facter | facter | Display all facts about the system |
facter | facter os | Display a specific fact about the system |
PuppetDB
#
Command/Option | Example | Description |
---|
puppet query | puppet query 'nodes { certname ~ "web" }' | Query the PuppetDB |
puppet facts find | puppet facts find <node> | Retrieve facts for a specific node |
Puppet CA Management
#
Command/Option | Example | Description |
---|
puppet cert list | puppet cert list | List all certificate requests |
puppet cert sign | puppet cert sign <hostname> | Sign a certificate request |
puppet cert revoke | puppet cert revoke <hostname> | Revoke a certificate |
This cheatsheet covers the most commonly used Puppet commands and options, helping you to manage agents, servers, modules, resources, facts, PuppetDB, and certificate authorities effectively.