Writing a papply script
We'd like to make it as quick and easy as possible to apply Puppet on a machine; for this we'll write a little script that wraps the puppet apply
command with the parameters it needs. We'll deploy the script where it's needed with Puppet itself.
How to do it...
Follow these steps:
In your Puppet repo, create the directories needed for a Puppet module:
t@mylaptop ~$ cd puppet/modules t@mylaptop modules$ mkdir -p puppet/{manifests,files}
Create the
modules/puppet/files/papply.sh
file with the following contents:#!/bin/sh sudo puppet apply /etc/puppet/cookbook/manifests/site.pp \--modulepath=/etc/puppet/cookbook/modules $*
Create the
modules/puppet/manifests/init.pp
file with the following contents:class puppet { file { '/usr/local/bin/papply': source => 'puppet:///modules/puppet/papply.sh', mode => '0755', } }
Modify your
manifests/site.pp
file as follows:node default { include base include puppet }
Add the Puppet module to the Git repository and commit...