/pupsus

Manage Puppet Modules with Nexus

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

Pupsus

Pupsus allows you to use stored Puppet Modules in Nexus (Or possibly any other Maven Repo). Puppet modules need to be in PuppetForge structure and like 'puppet module' command will handle module dependencies.

Usage

The default configuration for Pupsus can be found in /etc/pupsus/pupsus.ini, this location can be overwritten with environment variable PUPSUS_CONFIG. The configuration file is a standard INI file with 2 sections [pupsus_main] and [puppet]:

[pupsus_main]

  • nexus_url : Full URL to nexus repository
  • aritifact_group : Maven style group ID of the puppet modules in Nexus (i.e some.artfiact.group)
  • cache_dir : Pupsus cache directory, requests to Nexus are cached.
  • nexus_repository : The Nexus repository where modules are stored.

[puppet]

  • config : Location of Puppet configuration file
  • command : Path to Puppet command

All configuration file settings can be overridden from the command line

Command Line Options

usage: pupsus [-h] [-u NEXUS_URL] [-g ARTIFACT_GROUP] [-d CACHE_DIR]
                 [-e, ENVIRONMENT] [-m PUPPET_MODULEPATH] [-f PUPPET_CONFIG]
                 [-p PUPPET_COMMAND]
                 {installenv,search,remove,install} ...

optional arguments:
  -h, --help            show this help message and exit
  
  -u NEXUS_URL, --nexus-url NEXUS_URL
                        URL to Nexus
                        
  -g ARTIFACT_GROUP, --artifact-group ARTIFACT_GROUP
                        Artifact group for modules
                        
  -d CACHE_DIR, --cache-dir CACHE_DIR
                        Directory used to store cache information
                        
  -e, ENVIRONMENT, --environment ENVIRONMENT
                        Puppet environment queried for Modulepath
  
  -m PUPPET_MODULEPATH, --modulepath PUPPET_MODULEPATH
                        Puppet Module path, please note if environment is
                        specified, then the modulepath from Puppet environment
                        will used
                        
  -f PUPPET_CONFIG, --puppet-config PUPPET_CONFIG
                        Puppet configuration file
                        
  -p PUPPET_COMMAND, --puppet-command PUPPET_COMMAND
                        Path to Puppet command

Commands:
  {installenv,search,remove,install}
    install             Install a Puppet module
    search              Search for a Puppet module
    installenv          Install all modules for a Puppet environment
    remove              Remove a module

To install all modules for a given environment, a YAML file with a list of modules (and version to install) is required in the modulepath. This file needs to be called {environment}.env (i.e production.env). Below is an example of this file:

---
'puppetlabs/stdlib' : 'latest'
'puppetlabs/ntp' : '1.0.1'
'someuser/somemodule' : '>2.1.0'

As can be seen from the example, Pupsus supports Semantic Versioning (http://semver.org/spec/v2.0.0.html) for the version number.