A Puppetfile specifies detailed information about each environment’s Puppet code and data, including where to get the code and data from, where to install it, and what version of it to install.
Version and installation information
Puppet version: 3.0 and above
Component: r10k or Puppet Enterprise Code Manager
Installation type: Standard
The Puppetfile
r10k and Puppet Enterprise Code Manager use Puppetfiles to install and manage the content of your environments.
A Puppetfile controls:
- Modules from the Forge
- Modules and data from Git repositories
A Puppetfile is a text file that specifies where to get the content from, what content you want, and what version of the content that you want for each environment.
For each environment where you want to manage content, you need a Puppetfile. Create a base Puppetfile in your default environment/branch (usually production). Each environment created based on your default branch inherits the base Puppetfile. You can then edit each environment’s Puppetfile as needed.
Puppetfile Example
Puppetfile
forge "http://forge.puppetlabs.com"
# Component Modules
mod 'puppetlabs-inifile', '4.1.0'
mod 'puppetlabs-stdlib', '6.2.0'
mod 'puppetlabs-java', '6.0.0'
mod 'puppetlabs-chocolatey', '5.0.2'
mod 'puppetlabs-iis', '7.0.0'
mod 'puppet-archive', '4.4.0'
mod 'puppet-hiera', '4.0.0'
mod 'tomcat',
git: 'git@github.com:puppetlabs/puppetlabs-tomcat.git',
tag: '4.0.0'
mod 'apache',
git: 'https://github.com/puppetlabs/puppetlabs-apache',
branch: 'release'
# Hiera data
mod 'site_data',
git: 'git@git.example.com:site_data.git',
install_path: 'data'
Guidelines for managing and maintaining a Puppetfile
-
List all modules and their dependencies in the Puppetfile. Only the modules listed in the Puppetfile are deployed to
environments/${environment}/modules
-
Use unique module names. (No duplicate module names.)
-
Hard code (version lock) all modules in your
production
Puppetfile. -
Hard code (version lock) all modules in all long-lived branches.
-
When developing code, you can use ref or branch names (instead of version numbers).
-
The commit message for each module you add should describe why it was added.
-
Verify Puppetfile syntax by running
r10k puppetfile check Puppetfile
Comments
0 comments
Please sign in to leave a comment.