I think I made a mistake and made it too complicated out of the gate. I did some bad things in my configs, like set environments for different things.
So lets review a basic puppetmaster config with environments.
It is in the standard /etc/puppet/puppet.conf location
[main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter environmentpath = $confdir/environments basemodulepath = $confdir/modules dns_alt_names = puppet,puppet.velcrohurts.com,puppet.velcrohurts.local prerun_command=/etc/puppet/etckeeper-commit-pre postrun_command=/etc/puppet/etckeeper-commit-post server = puppet.velcrohurts.com runinterval = 300 [master] # These are needed when the puppetmaster is run by passenger # and can safely be removed if webrick is used. ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY
So that little bit tells us we want to use environments in /etc/puppet/environments/
inside that directory we have
stephen.mcgroarty@nostrings:~$ ls /etc/puppet/environments/
development example_env production staging
I think the labels are self explanatory here, but you can add a folder for whatever environment you want.
I recommend usign the environment = tag on the clients.
I actually have a puppet manifest for the client side, so that when I put them in it stays there.
For the client, I have this manifest under /etc/puppet/environments/staging/modules/puppet/manifests/init.pp
class puppet { file { '/etc/puppet/puppet.conf': ensure => file, mode => '644', owner => 'root', group => 'root', source => 'puppet:///modules/puppet/puppet.conf.erb' } }
Then for the modules/puppet/files/puppet.conf.erb I have the puppet config.
## Managed by Puppet ## [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter server = puppet.velcrohurts.local environment = staging runinterval = 500
I change the environment = based on what location I want, and using puppet to control the puppet.conf might seem a bit odd, but it never changes on a single server for very long.