Puppet Tips and Tricks

Simple Puppet snippets for easier cutting and pasting...

Setting up puppet on a new machine:

wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
dpkg -i puppetlabs-release-pc1-xenial.deb
apt-get update
apt-get upgrade
apt-get install puppet-agent
ln -s /opt/puppetlabs/bin/* /usr/local/bin

 

Create a new module:

puppet module generate wkumari-foo

 

Run / apply a single module (for example, while testing):

puppet apply --noop --test -e "include foo"

or the longer version:

puppet apply  --noop --test --modulepath="/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules" -e "class {test_mailserver: param => 'bar'} include test_mailserver" 

and with hiera info:

puppet apply --hiera_config /etc/puppetlabs/puppet/hiera.yaml --noop --test --modulepath="/etc/puppetlabs/code/modules:/etc/puppetlabs/code/environments/production/modules" -e " include test_mailserver" 

 

 

Additional information