Puppet Cheat Sheet


show all facters
show OS Family facter
facter osfamily
show facters in YAML
facter -y
show facters in JSON
facter -j
get Puppet Enterprise version
facter -p grep pe_
get Puppet agent All-in-one version
facter -p grep aio
use fact inside a manifest using 'facter' function
notify { 'OS is ${::facts['operatingsystem']}': }
use fact inside manifest directly
notify { 'OS is $::operatingsystem': }
get facter Hash
facter system_uptime
days => 2,
hours => 70,
seconds => 253058,
uptime => '2 days' }

facter system_uptime.hours
  • Nov 25, 2018 - This Pin was discovered by Uzma. Discover (and save!) your own Pins on Pinterest.
  • Support the #MurdochRoyalCommission campaign at come out alive on climate change, Murdoch's puppet needed a cheat sheet.Some statement.
  • Yes, we know, there is a famous Puppet cheat sheet available at docs.puppet.com. This is my personal collection of different Puppet DSL items, which I usually generate at each official Puppet Fundamentals training. Now I found the time to paste them into a blog posting and add information on code logic and hiera. Puppet DSL Resource type.

A Puppet Cheat Sheet. Puppet is a configuration management tool that helps system administrators automate the provisioning, configuration and management of a server infrastructure. It’s usually run in master/agent mode where the master server manages the configuration of several agent nodes. Once you do that, we'll send you the FREE 'Cheat Sheet'. These tips for promoting your art online will be sent once a day for 5 days straight to your inbox. STEP 2: Support the Puppet Podcast (+BONUS).

get OS major release from manifest


Run MCollective as 'peadmin'
sudo -i -u peadmin
check connection to nodes
mco ping

get nodes by Facter name
mco facts timezone
check how many MCO nodes are running
mco puppet count
restart apache service
mco rpc service restart service=httpd
check status of a package
mco package status puppet
list all subcollectives
mco inventory ––list-collectives

disable puppet agent on node
mco puppet disable -I nodename
find all nodes that are x64
mco ping -F architecture=x86_64
find all nodes containing NYC in hostname
mco find ––with-identity /nyc/

find all nodes with nginx class
mco find ––with-class nginx
kick off 'puppet agent -t' on your nodes
mco puppet runall -F osfamily=Redhat 5

this will run puppet agent -t on all nodes where
osfamily fact = redhat, 5 concurrent runs
kick off Puppet run on node 'abc.xyz'
mco puppet runonce -l abc.xyz
run command against a subcollective
mco ping -T us_collective
start/stop service on a node
mco service ntp start -I ny14.nyc

show all available MCO plugins
mco plugin doc
show last run statistics for all nodes
mco rpc puppet last_run_summary

mco client logs (on PE Master)


print modulepath:
puppet config print modulepath

modules help:
puppet help module
search available modules: (PuppetForge)
puppet module search 'nginx'

Puppet Stayman Cheat Sheet

install a module
puppet module install author/module
build new module with full skeleton:
puppet module generate author/module
list installed modules:Sheet
puppet module list

check for missing module dependencies
puppet module list --tree
build a module release package (.tar.gz)
puppet module build author/module
show modified files of an installed module
puppet module changes
Module paths:

Puppet Stayman Cheat Sheet

# main module dir
apache/manifests # manifest code
apache/lib # plugins, ruby code
apache/templates # ERB templatesPuppet Cheat Sheet
apache/files # files used in module
apache/tests # usage examples

Puppet Exported Resources Cheat Sheet

apache/Modulefile # metadatapaths inside a module:

content => template('mysql/my.cnf.erb'),

Template is in: $modulepath/mysql/templates/my.cnf.erb

source => 'puppet:///modules/mysql/my.cnf'

File is in: $modulepath/mysql/files/my.cnf


Augeas binary tool
show all available lenses
augtool> ls /augeas/load/
set value in a file
augtool> set /files/etc/ssh/sshd_config/PermitrootLogin no
augtool> save
get specific data tree branch

cat /etc/hosts puppetmaster localhost localhost.localdomain ::1 localhost localhost.localdomain localhost6
#managed nodes host1 host2

augtool> ls /files/etc/hosts

1/ = (none)
2/ = (none) #comment = managed nodes
3/ = (none)
4/ = (none)

augtool> ls /files/etc/hosts/4

ipaddr =
canonical = host2
check Augeas version
ls /augeas/
root = /
context = /files
variables = (none)
version/ = 1.4.0
save = overwrite
span = disable
load/ = (none)
files/ = (none)

Augeas Help

Admin commands:
help - print help
load - (re)load files under /files
quit - exit the program
retrieve - transform tree into text
save - save all pending changes
store - parse text into tree
transform - add a file transform

Read commands:

dump -xml - print a subtree as XML
get - get the value of a node
label - get the label of a node
ls - list children of a node
match - print matches for a path expression
print - print a subtree
errors - show all errors encountered inprocessing files
span - print position in input filecorresponding to tree

Write commands:

clear - clear the value of a node
clearm - clear the value of multiple nodes
ins - insert new node
insert - insert new node (alias of 'ins')
mv - move a subtree
move - move a subtree (alias of 'mv')
cp - copy a subtree
copy - copy a subtree (alias of 'cp')
rename - rename a subtree label
rm - delete nodes and subtrees
set - set the value of a node
setm - set the value of multiple nodes
touch - create a new node
Augeas in manifest
or if making multiple changes to same file


4 types of functions
Hiera Array
$ hiera ssh_users['root', 'jeff', 'gary', 'hunter']
$ hiera ssh_users.0
Hiera Hash:
$ hiera user{'name'=>'kim', 'home'=>'/home/kim'}
$ hiera user.name
use Hiera for class assignment in Site.pp
Hiera config file

- 'nodes/%{::clientcert}'
- 'roles/%{::role}'
- '%{::osfamily}'
- '%{::environment}'
- common
sample hiera xyz.yaml
### xyz
- apache
- apache::vhost
- ntp
owner: joe smith
location: new york
business_unit: billing
Get hiera value for this host:
hiera classes ::hostname=xyz ::environment=production
['apache', 'apache::vhost', 'ntp']
run Hiera in debug mode:
hiera classes ::hostname=xyz -d
Use Hiera in manifest:
$my_dns_servers = hiera('dns_servers')
or array:
$my_dns_servers = hiera_array('dns_servers')
get Hiera key value directly from command line
puppet apply -e 'notice(hiera('<KEY>'))'
Log File locations:


run script every day at 12.30am
command => '/usr/bin/python myscript.py',

Puppet Cheat Sheet Pdf

minute => '30',
run script every tue at 5 am
command => '/usr/bin/python myscript.py',
minute => '0',
weekday => 'Tuesday'


404 error, could not request certificate when running

I'm looking for reasonably printable Puppet cheat sheets. Dropbox access. I'm interested in core types, modules and specifically the Hiera module.

The pretty core type cheat sheet shown here does not exist at the provided 'grab it' link here. The information is on the page, but it doesn't render correctly when printed from a browser. Firefox prints a bunch of blank pages, printing from IE and Chrome is clunky and unreadable by anyone past their twenties.

The image on the first page listed above is too small to print, and there's nothing in the entire Puppet docs directory as far as I can tell, that's anything like a printable version of this doc.

I've looked through the docs and resources on the puppet site, and done several Google searches and can't find anything like a full size copy of the image above. What am I missing? Is this resource only available to customers of Puppet Enterprise?

editretagflag offensiveclosemergedelete