Fetching and applying changes automatically
In a stand-alone Puppet architecture, each node needs to automatically fetch any changes from the Git repo at regular intervals, and apply them with Puppet. We can use a simple shell script for this, and there's one in the
examples repo (
#!/bin/bash cd /etc/puppetlabs/code/environments/production && git pull /opt/puppetlabs/bin/puppet apply manifests/
We will need to install this script on the node to be managed by Puppet, and create a cron job to run it regularly (I suggest every 15 minutes). Of course, we could do this work manually, but isn't this book partly about the advantages of automation? Very well, then let's practice what we're preaching.