Here’s the help info:
Announcement
You can find all my latest posts on medium.[vagrant@puppetmaster /]$ r10k --help --verbose NAME r10k - Killer robot powered Puppet environment deployment USAGE r10k[options] DESCRIPTION r10k is a suite of commands to help deploy and manage puppet code for complex environments. COMMANDS deploy Puppet dynamic environment deployment environment DEPRECATED: Operate on a specific environment help show help module DEPRECATED: Operate on a specific puppet module puppetfile Perform operations on a Puppetfile synchronize DEPRECATED: Fully synchronize all environments version Print the version of r10k OPTIONS -c --config Specify a global configuration file (deprecated, use `r10k deploy -c`) -h --help Show help for this command -t --trace Display stack traces on application crash -v --verbose Set log verbosity. Valid values: fatal, error, warn, notice, info, debug, debug1, debug2 [vagrant@puppetmaster /]$
There is more help info for each of the above commands.
For example, for the “puppetfile” subcommand, we have:
[vagrant@puppetmaster /]$ r10k puppetfile --help NAME puppetfile - Perform operations on a Puppetfile USAGE r10k puppetfileDESCRIPTION `r10k puppetfile` provides an implementation of the librarian-puppet style Puppetfile (http://bombasticmonkey.com/librarian-puppet/). SUBCOMMANDS check Try and load the Puppetfile to verify the syntax is correct. install Install all modules from a Puppetfile purge Purge unmanaged modules from a Puppetfile managed directory OPTIONS FOR R10K -c --config Specify a global configuration file (deprecated, use `r10k deploy -c`) -h --help Show help for this command -t --trace Display stack traces on application crash -v --verbose Set log verbosity. Valid values: fatal, error, warn, notice, info, debug, debug1, debug2 [vagrant@puppetmaster /]$
We can also go even deeper:
[vagrant@puppetmaster /]$ r10k puppetfile check --help --verbose NAME check - Try and load the Puppetfile to verify the syntax is correct. USAGE r10k puppetfile check OPTIONS FOR PUPPETFILE -c --config Specify a global configuration file (deprecated, use `r10k deploy -c`) -h --help Show help for this command -t --trace Display stack traces on application crash -v --verbose Set log verbosity. Valid values: fatal, error, warn, notice, info, debug, debug1, debug2 [vagrant@puppetmaster /]$
Now lets try this command:
$ r10k puppetfile check Syntax OK
This will whether the syntax is ok, but won’t check if there are any missing dependencies, for this you need to do:
$ puppet module --tree --modulepath /etc/puppetlabs/code/environments/{env_name}/modules
If there are missing dependencies, then a quick way to fix these is by using:
https://github.com/rnelson0/puppet-generate-puppetfile
Going back to the help info, let’s look up the help info for the “deploy” subcommand:
$ r10k deploy NAME deploy - Puppet dynamic environment deployment USAGE r10k deployDESCRIPTION `r10k deploy` implements the Git branch to Puppet environment workflow (https://puppetlabs.com/blog/git-workflow-and-puppet-environments/). SUBCOMMANDS display Display environments and modules in the deployment environment Deploy environments and their dependent modules module Deploy modules in all environments OPTIONS -c --config Specify a configuration file OPTIONS FOR R10K -c --config Specify a global configuration file (deprecated, use `r10k deploy -c`) -h --help Show help for this command -t --trace Display stack traces on application crash -v --verbose Set log verbosity. Valid values: fatal, error, warn, notice, info, debug, debug1, debug2 [vagrant@puppetmaster /]$
Another useful help info is:
$ r10k deploy environment --help NAME environment - Deploy environments and their dependent modules USAGE r10k deploy environment<...> DESCRIPTION `r10k deploy environment` creates and updates Puppet environments based on Git branches. Environments can provide a Puppetfile at the root of the directory to deploy independent Puppet modules. To recursively deploy an environment, pass the `--puppetfile` flag to the command. **NOTE**: If an environment has a Puppetfile when it is instantiated a recursive update will be forced. It is assumed that environments are dependent on modules specified in the Puppetfile and an update will be automatically scheduled. On subsequent deployments, Puppetfile deployment will default to off. OPTIONS -p --puppetfile Deploy modules from a puppetfile OPTIONS FOR DEPLOY -c --config Specify a configuration file -c --config Specify a global configuration file (deprecated, use `r10k deploy -c`) -h --help Show help for this command -t --trace Display stack traces on application crash -v --verbose Set log verbosity. Valid values: fatal, error, warn, notice, info, debug, debug1, debug2 [vagrant@puppetmaster dev_virtualbox_v2]$
If your current working directory contains the Puppetfile, manifests folder, modules folder, and environment.conf:
$ pwd /etc/puppet/environments/production $ ls -l total 16 -rw-rw-rw-. 1 root root 374 Oct 14 16:46 environment.conf drwxrwxrwx. 2 root root 20 Oct 14 16:46 manifests drwxrwxrwx. 69 root root 4096 Oct 15 12:34 modules -rw-rw-rw-. 1 root root 4906 Oct 15 12:30 Puppetfile $ ls -l modules/ # notice it is currently empty.
Then you can populate your modules folder by either running the following (if currently in the same directory as the Puppetfile):
$ r10k puppetfile install
Or by running:
$ r10k deploy environment -v -p {prefix_branchname}
Note, The prefix is whatever you specified in your hiera.yaml file.
e.g. let’s say we have
$ cat /etc/r10k.yaml :cachedir: '/var/cache/r10k' :sources: puppet_System_X: remote: https://github.com/control-repo-System_X.git basedir: '/etc/puppet/environments' prefix: 'System_X' hiera_System_X: remote: https://github.com/hiera-repo-System_X.git basedir: '/etc/puppet/hiera' prefix: 'System_X' puppet_System_Y: remote: https://github.com/control-repo-System_Y.git basedir: '/etc/puppet/environments' prefix: 'System_Y' hiera_System_Y: remote: https://github.com/hiera-repo-System_Y.git basedir: '/etc/puppet/hiera' prefix: 'System_Y' puppet_System_Z: remote: https://github.com/control-repo-System_Z.git basedir: '/etc/puppet/environments' prefix: 'System_Z' hiera_CSP: remote: https://github.com/hiera-repo-System_Z.git basedir: '/etc/puppet/hiera' prefix: 'System_Z' :purgedirs: - /etc/puppet/environments - /etc/puppet/hiera
Now let’s say we are interested in “System_X” of which we are only insterested in this repo’s branch called “Production”, then we do:
$ r10k deploy environment -v -p System_X_Production
Note: if the branch name contains periods, forward slashes, or hyphens, then they get replaced with underscores.
Now let’s check this has worked:
$ ls -l modules/ drwxrwxrwx. 4 root root 4096 Oct 14 16:47 alternatives drwxrwxrwx. 8 root root 4096 Oct 14 16:47 apache drwxrwxrwx. 5 root root 4096 Oct 14 16:46 augeas drwxrwxrwx. 5 root root 4096 Oct 14 16:46 augeasproviders_base drwxrwxrwx. 6 root root 4096 Oct 14 16:46 augeasproviders_core drwxrwxrwx. 5 root root 4096 Oct 14 16:46 augeasproviders_pam drwxrwxrwx. 7 root root 4096 Oct 14 16:47 autofs . . ...etc
https://www.google.co.uk/search?q=r10k&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=jJCZVJHdKMyq8weP3IGwBQ
http://puppetlabs.com/search/node/r10k