Ask Your Question

hiera_hash command not getting hiera data from module layer

asked 2018-12-25 23:48:15 -0600

mlanghor gravatar image

Hello, I'm trying to catch up to Puppet 5.5 from 3.x, so maybe there's a newer/better way to do what I'm attempting. If so please point out the errors of my ways.

Anyway, to the issue. I'm attempting to use a custom designed type to create nagios services, allowing me to set defaults such as target and controlling what parameters attempt to set. The defined type is creating the services as exported resources for later collection. Direct use of this as a regular parameterized class works well.

The issues I'm having, is for a the list of base services I want to always monitor. I'd like to define that list as an array of hashes in hiera. It's similar to what I'm already doing for some custom apache related modules. In a custom_nrpe::monitor class I have:

$default_monitors = hiera_hash('custom_nrpe::monitor',{})

And this works fine if my data is in a hierarchy laid out in /etc/puppetlabs/puppet/hiera.yaml. And if I perform a puppet lookup custom_nrpe::monitor. However, if I attempt to put that data within the module, it seems to get no data. It seems like the hiera_hash is coming up empty? However if I try to just create a file with the content => $custom_nrpe::monitor, I receive data type errors complaining of trying to use a hash as a string.

edit retag flag offensive close merge delete


In my tests it worked without problem with puppet 5.5.4. I would suggest you try on you puppet master: "puppet master --no-daemonize --logdest console --environment [environmentname] --compile [nodename] --debug". The output should contain a detailed description how it tried to lookup the value.

vicinus gravatar imagevicinus ( 2018-12-26 04:58:48 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-28 10:06:07 -0600

mlanghor gravatar image

chalk this up to user error, and changing too many things at a time. After a bit of cleanup, the puppet lookup command does work as expected.

And as to the hiera_hash, it's in the docs that this command won't work with reading a hiera.yaml within the the module.

edit flag offensive delete link more


hiera_hash i deprecated.

c4f4t0r gravatar imagec4f4t0r ( 2019-01-07 00:16:05 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-12-25 23:48:15 -0600

Seen: 150 times

Last updated: Dec 28 '18