Deploying changes with Rake

Like everyone who makes his living with a keyboard, I hate unnecessary typing. If you are using the workflow described in the section on using version control, you can add some automation to make this process a little easier. There are several tools that can run commands for you on remote servers, including Capistrano and Fabric, but for this example we'll use Rake.

Getting ready

If you don't have Rake installed already, run the following command:

apt-get install rake

You'll need a working Internet connection.

How to do it...

  1. Create a file in the top level of your Puppet working copy named Rakefile that looks like this:
    PUPPETMASTER = 'cookbook' SSH = 'ssh -t -A' task :deploy do sh "git push" sh "#{SSH} #{PUPPETMASTER} ...

Get Puppet 2.7 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.