Thanks for the reply John. Here's my hiera.yaml file:
---
:backends:
- yaml
:yaml:
:datadir: "/etc/puppet/%{::environment}/hieradata"
:hierarchy:
- "nodes/%{::clientcert}"
- "roles/%{::esg_role}"
- common
My puppet.conf file on the puppet master:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
templatedir=$confdir/templates
privatekeydir = $ssldir/private_keys { group = service }
hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
pluginsync=true
[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
autosign = $confdir/autosign.conf { owner = service, group = service, mode = 664 }
[production]
manifest = /etc/puppet/production/manifests/site.pp
modulepath = /etc/puppet/production/modules
fileserverconfig = /etc/puppet/production/fileserver.conf
templatedir = /etc/puppet/production/templates/
[staging]
manifest = /etc/puppet/staging/manifests/site.pp
modulepath = /etc/puppet/staging/modules
fileserverconfig = /etc/puppet/staging/fileserver.conf
templatedir = /etc/puppet/staging/templates/
[development]
manifest = /etc/puppet/development/manifests/site.pp
modulepath = /etc/puppet/development/modules
fileserverconfig = /etc/puppet/development/fileserver.conf
templatedir = /etc/puppet/development/templates/
And finally, the agent node's puppet.conf:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
[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
[agent]
environment=development
I tried runnning the puppet agent and specifying the environment on the command line but it didn't make a difference.I also moved the environment directive in the agent conf file to the [main] section, but still no change.
Running hiera from the command line with the same settings as the agent has, I get this:
$ hiera -d classes ::environment=development ::esg_role=couchbase
DEBUG: Thu Sep 12 17:45:31 +0000 2013: Hiera YAML backend starting
DEBUG: Thu Sep 12 17:45:31 +0000 2013: Looking up classes in YAML backend
DEBUG: Thu Sep 12 17:45:31 +0000 2013: Looking for data source roles/couchbase
DEBUG: Thu Sep 12 17:45:31 +0000 2013: Found classes in roles/couchbase
[{"couchbase"=>nil}]
Testing for fact esg_role on the agent node:
$ facter esg_role
couchbase
For the record, my puppet version is 3.2.4, hiera is 1.2.1.
Hope this helps.
Regards,
Guy