Configure dynamic environments for puppet

David Gwilliam



9,462 latest version

2.0 quality score

Version information

  • 0.1.0 (latest)
released Dec 14th 2012

Start using this module


dhgwilliam/dynenv — version 0.1.0 Dec 14th 2012

dynenv - to manage dynamic puppet environments with git

ideated and documented in a Puppet Labs blog post and using the puppet-sync script from PSU's Computer Action Team

NB: there are other people out there hacking on Dynamic Environments, so when their blogs are back up we should add a link to the relevant post


In order for this to work, you must have reasonably configured the following tools, preferably on both boxes:

  • git
  • ruby (available in the PATH)

You also must have storeconfigs = true enabled in your puppetmaster's puppet.conf

Sample Usage

    class { 'usa-perf-dynenv':
      # this user need not exist on the destination boxes
      dynenv::user { 'dhgwilliam':
        key_type => 'ssh-rsa',
        key => 'AAAA(.*)=',
      class { 'dynenv':
        sync_user => 'puppet-sync',
        puppetmaster_fqdn => 'puppet.perf.usacompany.com',
        githost_fqdn => 'usa-pup-git-01.perf.usacompany.com',
        git_repo => '/var/lib/git/modules',
        env_dir => '/etc/puppetlabs/puppet/environments',
    node 'usa-pup-git-01' {
      include usa-perf-dynenv
    node 'puppet.perf' {
      include usa-perf-dynenv


this module assumes that githost and puppetmaster are on separate boxes. That said, I suspect it would work just fine if puppetmaster_fqdn and githost_fqdn were the same, although I have not tested this.

the module explicitly does not manage the modules repo for you, so when creating a new git_host, you must either copy an existing repo or create a bare one with git init .

You must manually alter the puppetmaster's puppet.conf to actually enable the dynamic environments, this only lays out the filesystem foundation.

I'd imagine there are some other assumptions contained herein that are undocumented.