Puppet cheat sheet
Agent
action | command |
Client bootstrap | puppet agent --server puppetmaster --waitforcert 60 --test |
Validate manifest syntax | puppet parser validate init.pp |
Puppet dry run | puppet agent --noop --verbose |
Disable/Enable Agent | puppet agent --disable / --enable |
Execute specific class | puppet agent --tags Some::Class |
Cert managment
puppet cert list
puppet cert list --all
puppet cert sign <name>
puppet cert clean <name>
puppet node clean <name> # removes node + cert
Module managment
puppet module list
puppet module install <name>
puppet module uninstall <name>
puppet module upgrade <name>
puppet module search <name>
Inspecting Resources/Types
puppet describe -l
puppet resource <type name>
# Querying Examples
puppet resource user john.smith
puppet resource service apache
puppet resource mount /data
puppet resource file /etc/motd
puppet resource package wget
# Trigger puppet run from master
puppet kick <name>
puppet kick -p 5 <names> # 5 parallel
Hiera Queries
On Puppet master
hiera <key> # to query common.yaml only
hiera <key> -m <FQDN> # to query config of a given node (using mcollective)
hiera <key> -i <FQDN> # to query config of a given node (using Puppet inventory)
hiera <key> environment=production fqdn=myhost1 # to pass values for hiera.yaml
# To dump complex data
hiera -a <array key>
hiera -h <hash key>
Hiera Debuging
puppet apply -e "notice(hiera_array('some key'))"
$ cat /etc/puppet/manifests/site.pp
notice("hostname: ${::hostname}")
notice("fqdn: ${::fqdn}")
notice("certname: ${::certname}")
$ puppet master \
--hiera_config /etc/puppet/hiera.yaml \
--manifest /etc/puppet/manifests/site.pp \
--modulepath /etc/puppet/modules \
--compile test01
Facter
command | description |
facter | All system facts |
facter -p | All system facts and puppet facts |
facter -y | Facts in YAML format |
facter -j | Facts in JSON format |
facter [-p] | A specific fact |
Links
No comments:
Post a Comment