Puppet – r10k and the Puppetfile

The “Puppetfile” is list of all puppet modules you want downloaded into your puppet master’s modules folder:

The first line of this file should be:

forge "http://forge.puppetlabs.com"

After that any puppet forge modules are listed as:

mod 'puppetlabs/stdlib',  '4.5.1'

Next any puppet modules hosted on git (e.g. github or any other git server, e.g. stash) can also be added, based on git’s commit id:

mod 'sudo',
  :git => 'https://github.com/saz/puppet-sudo.git',
  :ref => '231e15fb9311233ee0fe12f4d9bd6ec978d54a2c'

or a particular, irrespective of branch:

mod 'sudo',
  :git => 'https://github.com/saz/puppet-sudo.git',
  :ref => '231e15fb9311233ee0fe12f4d9bd6ec978d54a2c'

or a particular branche’s latest commit:

mod 'sudo',
  :git => 'https://github.com/saz/puppet-sudo.git',
  :ref => '{branch-name}'

Or even a particular git (version) tag:

mod 'sudo',
  :git => 'https://github.com/saz/puppet-sudo.git',
  :tag => '1.2.0'

Note, ensure you include all module dependencies. Then to check that you all dependencies are included, run:

$ puppet module list --tree --modulepath /etc/puppetlabs/code/environments/{env-name}/modules