Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Custom Facts are not working with hiera on puppet agent nodes

We have created a custom factor "datacenter" via <modulename>/lib/facter/datacenter.rb on puppet master node. when i ran facter -p datacenter, it works fine, and so added the same in hiera.yaml.

---
:backends:
  - yaml
:hierarchy:
  - "nodes/%{::trusted.certname}"
  - "%{::datacenter}"
  - "%{::osfamily}"
  - 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 ran "puppet agent -t" on puppet master it runs fine.. and picked the hiera parameter value from <datacentervalue>.yaml, but when we ran the same "puppet agent -t" on agent nodes, it fails, with the error " could not find data item in any of the hiera file" Can someone please help to debug this...