In an attempt to split our puppet setup so I can have a different version of our puppet code on different environments at the same time I have restructured the puppetmaster directory like this:
/etc/puppet (looking to try and make this redundant)
/etc/puppet/production
/etc/puppet/staging
/etc/puppet/staging2
/etc/puppet/staging3
Here is my current /etc/puppet/puppet.conf setup
[main]
server=puppet
masterport=8180
confdir=/etc/puppet/$environment
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
config_version=$confdir/bin/current_revision
pluginsync = true
[master]
modulepath = $confdir/modules
manifest = $confdir/manifests/site.pp
This is how I want to configure hiera ie have a set of hiera data for each environment
---
:yaml:
:datadir: "/etc/puppet/%{environment}/hieradata"
:hierarchy:
- "%{::domain}/common"
- "%{::domain}/backup"
- "%{::domain}/supporter_url_redirects"
- 'users'
- 'backup'
- 'common'
All the agents now have this in their puppet.conf
[agent]
environment=staging3
So the problem I have is I can't get
:yaml:
:datadir: "/etc/puppet/%{environment}/hieradata"
to work. The problem is it defaults to "production" even though the agent has its environment setup.
Got any ideas now I can make it work as describe above?