Custom facts in hiera hierachy not working in CentOS 7
I'm trying to debug a problem where the custom facts from a node are not being used correctly when looking for hiera data. This is my hiera.yaml file:
---
:backends:
- eyaml
- yaml
:hierarchy:
- "nodes/%{::trusted.certname}"
- "role/%{::instance_role}"
- "environments/%{::environment}"
- certs
- common
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows
# When specifying a datadir, make sure the directory exists.
:datadir:
When I use this with a CentOS 6 node (vagrant box) and /opt/puppetlabs/facter/facts.d/instance_role.txt is set to:
instance_role=web
This works fine. However with the same setup on CentOS 7 (vagrant box) it gives:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find data item haproxy::listen in any Hiera data file and no default supplied at /etc/puppetlabs/code/environments/dev/site/profile/manifests/haproxy.pp:41:40 on node vagrant.example.com
If I change "role/%{::instance_role}" to "role/web" in hiera.yaml, then that works fine, but it doesn't look like puppet is passing on the custom fact on CentOS 7.
Using puppet 4.7.0, hiera 3.2.1, facter 3.4.1