I have the following hiera.yaml file:

---
:backends:
  - yaml
  - file

:hierarchy:
  - defaults
  - "%{clientcert}"
 * - "%{::domain}/%{::environment}/%{::osfamily}/%{::lsbdistcodename}"*
  - global

:yaml:
  :datadir: /etc/puppet/data

and the following in /etc/puppet/data:

*loc.example.com/production/Debian/wheezy.yaml*

The domain fact returns loc.example.com, the osfamily fact returns Debian 
and the lsbdistcodename returns wheezy.


When I run 

puppet apply --environment=production -e '$test = 
hiera('ssh_service_config') notify { $test: }'

I get the ssh_service_config variable from the 
 /etc/puppet/data/loc.example.com/production/Debian/wheezy.yaml file, which 
in my mind means that the correct file was chosen based on the 3 facts 
(environment. osfamily and lsbdistcodename), which is what I want.

However if I run:

$ puppet agent -tv --environment=production
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Could not find data item ssh_package_name in any Hiera data file and no 
default supplied at 
/srv/puppet/environments/production/modules/ssh/manifests/install.pp:2 on 
node puppetmaster.iad3.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Or:

$ hiera -d ssh_service_config environment=production osfamily=Debian 
lsbdistcodename=wheezy
DEBUG: 2014-01-06 19:18:08 +0000: Hiera YAML backend starting
DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in YAML 
backend
DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source defaults
DEBUG: 2014-01-06 19:18:08 +0000: Looking for data source global
DEBUG: 2014-01-06 19:18:08 +0000: Hiera File backend starting
DEBUG: 2014-01-06 19:18:08 +0000: Looking up ssh_service_config in File 
backend
DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data 
source 'defaults'
DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile 
/var/lib/hiera/defaults.d, skipping
DEBUG: 2014-01-06 19:18:08 +0000: Hiera File_backend: looking for data 
source 'global'
DEBUG: 2014-01-06 19:18:08 +0000: Cannot find datafile 
/var/lib/hiera/global.d, skipping
nil

Any idea what is going on? I would like to have a simple hierarchy like the 
one in the hiera.yaml file, based on the three facts.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f139fb4c-92f2-4616-a522-6bd69ecfd9fb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to