It might be the day or the unstable caffeine levels, but this one is bugging me for more than a day now so I decided to ask here.
The set up is simple:
- Puppet 4.3 with hiera
- puppetserver = test node
- hiera.yaml: https://gist.github.com/kreczko/3cfd094dd9e50b29f82f#file-hiera-yaml
In datadir:
- nodes/puppetserver.yaml: https://gist.github.com/kreczko/3cfd094dd9e50b29f82f#file-puppetserver-yaml
- groups/service.yaml: https://gist.github.com/kreczko/3cfd094dd9e50b29f82f#file-service-yaml
- common.yaml:https://gist.github.com/kreczko/3cfd094dd9e50b29f82f#file-common-yaml
- site class: https://gist.github.com/kreczko/3cfd094dd9e50b29f82f#file-init-pp
In the first iteration of 'puppet agent -t' my site class creates an external fact based on the information in "nodes/%{::fqdn}". This works.
In the second iteration I expect hiera to load values from 'groups/service.yaml' and printout 'message' (also defined in the site class). However, when that happens I see the value from common.yaml. Clearly hiera did not its job.
It becomes more confusing if instead I try 'puppet apply -e "notice hiera('message')" which prints correctly the value from groups/service.yaml.
So the fact itself works, but hiera does not make any decisions on it. From https://docs.puppetlabs.com/hiera/3.0/hierarchy.html and https://docs.puppetlabs.com/hiera/3.0/variables.html I would have expected this to work.
What am I doing wrong?
↧