Contents

GitHub Puppet Face

Contents

I was looking at Jesse Newland’s excellent knife-github-cookbooks tool and thought that this would be an excellent tool to write for Puppet too. With the release of Puppet Faces this is now incredibly easy to do. I created a tool called Puppet-GitHub-Face that allows you to install and compare modules from GitHub to modules in your Puppet module path. Currently Puppet Faces are only supported in Puppet 2.7.0 and later (2.7.0 is currently an RC but will hopefully be out soon!) and distributing them requires placing them into Puppet’s load path. They’ll shortly be distributable as Puppet modules using pluginsync. So to install the GitHub face for now clone the git repository:

$ git clone git://github.com/jamtur01/puppet-github-face.git

Copy the relevant files into your Puppet master’s path (for example on Debian/Ubuntu into a source-based install).

$ cp lib/puppet/application/github.rb /usr/local/lib/site_ruby/1.8/puppet/application/github.rb
$ cp lib/puppet/face/github.rb /usr/local/lib/site_ruby/1.8/puppet/face/github.rb

You can then see if the GitHub Face is installed like so:

$ puppet help

You should see the GitHub face listed in the available Puppet commands and you can now use it to install and compare installed modules. Let’s start with installing a module from Github, for example my puppet-httpauth module.

$ puppet github install --user jamtur01 --repo puppet-httpauth

This command will connect to GitHub, download the puppet-httpauth module and install it into your module path as the httpauth module (the Face automatically strips off prefix and suffix from a module, for example removing puppet-, puppet-module-, and -module from a repository name). Warning! If a module of the same name is already in your path it’ll get deleted and replaced with this new module. You can also compare the state of a currently installed module with its GitHub parent, like so:

$ puppet github compare --user jamtur01 --repo puppet-httpauth

This will return unified diff output showing any differences between the currently installed module and the module upstream on Github. Hope someone finds this useful!