Given this /etc/puppetlabs/code/hiera.yaml
---
:backends:
- json
:hierarchy:
- "%{hostname}.%{nt_environment}.%{nt_location}"
- "%{nt_type}.%{nt_environment}.%{nt_location}"
- "%{nt_type}.%{nt_environment}"
- "%{nt_environment}.%{nt_location}"
- "%{nt_environment}"
- "%{nt_location}"
- world
- default
:logger: console # debug
:json:
:datadir: '/etc/puppetlabs/code/environments/%{::environment}/hieradata' # this is the default anyway
and there exists /etc/puppetlabs/code/environments/prod/hieradata/sac.json, this "puppet lookup --debug icinga_servers --environment prod" produces
Debug: hiera(): Looking for data source puppetmaster.ops
Debug: hiera(): Looking for data source ops.sac
Debug: hiera(): Looking for data source ops
Debug: hiera(): Looking for data source sac
Debug: hiera(): Looking for data source world
Debug: hiera(): Looking for data source default
(& lots more of course).
Why can't it find the /etc/puppetlabs/code/environments/prod/hieradata/sac.json file which contains the key I'm looking for ?
Puppet server 2.4
23-06-2016:
Here's an extend debug o/p
Debug: Performing a hiera indirector lookup of icinga_servers with options {:variables=>Scope(Class[main]), :merge=>#
>, @value_type=#]>>>]>, @options={}>}
Debug: hiera(): Looking up icinga_servers in JSON backend
Debug: hiera(): Looking for data source puppet4test101.ops.sac
Debug: hiera(): Cannot find datafile /etc/puppetlabs/code/environments/prod/hieradata/puppet4test101.ops.sac.json, skipping
Debug: hiera(): Looking for data source puppet4test.ops.sac
Debug: hiera(): Cannot find datafile /etc/puppetlabs/code/environments/prod/hieradata/puppet4test.ops.sac.json, skipping
Debug: hiera(): Looking for data source puppet4test.ops
Debug: hiera(): Cannot find datafile /etc/puppetlabs/code/environments/prod/hieradata/puppet4test.ops.json, skipping
Debug: hiera(): Looking for data source ops.sac
Debug: hiera(): Looking for data source ops
Debug: hiera(): Looking for data source sac
HTH.
As above, the file /etc/puppetlabs/code/environments/prod/hieradata/sac.json, exists and is readable. nt_location shows as 'sac' on the node by using 'facter -p'.
It seems Hiera just doesn't see that file ...
Any ideas?
Chris
2016-07-05
jsonlint validates ok.
hiera -d icinga_servers -c /etc/puppetlabs/puppet/hiera.yaml nt_location=sac ::environment=prod
DEBUG: 2016-07-05 01:38:52 +0000: Looking for data source .sac
DEBUG: 2016-07-05 01:38:52 +0000: Cannot find datafile /etc/puppetlabs/code/environments/prod/hieradata/.sac.json, skipping
DEBUG: 2016-07-05 01:38:52 +0000: Looking for data source sac
DEBUG: 2016-07-05 01:38:52 +0000: Looking for data source world
(Shortened o/p)
Its looking in the right place, but doesn't match :(
@Alex: can't tarball it; its a prod system (confidential). OTOH, the hiera.yaml is as above, the sac.json (location as above) snippet would be
{
"env" : {
"datacenter" : "DC",
"dhcpserver" : "dhcp101.x.x.x",
"icinga_servers" : [
"icinga101.x.x.x"
],
},
}
Its working on the v3 server (this is v4), so its either a v4 issue or I've missed something in the setup.
HTH