O'Reilly logo

Puppet 4.10 Beginner's Guide - Second Edition by John Arundel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 (/vagrant/examples/files/run-puppet.sh):

#!/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.

Writing a manifest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required