r10kwrapper, a wrapper for handling multiple Puppetfiles in r10k

cat << EOF | curl -X PUT -d @- uberleet.org

This project is available on github. https://github.com/jonkelleyatrackspace/r10kwrapper-1

The problem this wrapper seeks to solve is the unweildy methods to passing Puppetfiles and module destinations to r10k. The native way r10k works is to export those options as shell vars, then run r10k. This wraps that functionality.

The reason I claim r10k is unwieldy is partially due to some issues I had with r10k.conf, and I feel this is easier in a few ways. We’re using this on a few of our environments puppetmasters on Puppet3 and Puppet4.

This wrapper takes explicit arguements to define PUPPETFILE path and MODULE PATH or it can load this information automatically out of a config file (/etc/r10k/wrapper.conf), and perform operations on 1 or more PUPPETFILE or MODULE PATHS.

You can define multiple r10k environments and extraction sites like this:


Then you can run r10kwrapper on your environment doing this:

r10kwrapper -x install -c profiles
usage: r10kwrapper [-h] [-p PUPPETFILE] [-d DEST] [-c CONFIGSECTION]
                   [-C CONFIGFILE] -x ACTION [-v VERBOSITY] [-f FLAGS_APPEND]

Wrapper for r10k to ease management of the Rackspace Puppet r10k structure.

optional arguments:
  -h, --help            show this help message and exit
  -p PUPPETFILE, --puppetfile PUPPETFILE
                        Path to Puppetfile holding module dependecies.
  -d DEST, --dest DEST  Path to deploy Puppetfile modules to.
                        Loads r10k settings from a ini section. This arguement
                        can be supplied multiple times. If ALL is supplied,
                        all sections will be executed. (ex -i modules -i
                        profiles -i signup -i cloudfeeds)
                        Defines the ini file to load. Otherwise it assumes
  -x ACTION, --action ACTION
                        Action to perform with Puppetfile
                        (check,install,purge) supported.
  -v VERBOSITY, --verbosity VERBOSITY
                        Log level (0 = error, 1 = warn, 2 = info, 3 = debug)
                        (Default: 3)
  -f FLAGS_APPEND, --flags_append FLAGS_APPEND
                        Pass trailing arguements to r10k command, (ex. -v

Leave a Reply

Your email address will not be published. Required fields are marked *