Posted on Thu 26 March 2015

Puppetfile.local support for librarian-puppet-simple

I am using librarian-puppet-simple to manage Puppet modules for my puppetmaster. It is a stripped down version of librarian-puppet with dependency resolution mechanism removed. It reads a Puppetfile and downloads modules from git repositories in ./modules or any other directory you configure (like /etc/puppet/modules).

I found the need to locally override the git repository locations of some modules by my own for test and development purposes. One example is the need to test a change in a Puppet module without having to push your commit to the official remote repository first.

Here is how you can add support for Puppetfile.local in Puppetfile:

# Puppetfile

mod "nova",
  :git => "https://github.com/stackforge/puppet-nova.git",
  :ref => "stable/icehouse"

eval(File.read('Puppetfile.local')) if File.exists?('Puppetfile.local')

In Puppetfile.local, you can then override the git repository location:

# Puppetfile.local

mod "nova",
  :git => "~/dev/puppet-modules/puppet-nova",
  :ref => "stable/icehouse"

Don't forget to add Puppetfile.local to .gitignore!

© Mathieu Gagné. Built using Pelican. Theme by Giulio Fidente on github.