Ask Your Question

Where does hiera search for data sources? [closed]

asked 2013-09-19 08:15:47 -0500

robrwo gravatar image

We have a simple hiera.yaml:

  - yaml
  - "servers/%{::hostname}"
  - common
  :datadir: "/etc/puppet/hiera"

In /etc/puppet/hiera, we have a "common.yaml" file and "servers" directory with appropriately named .yaml files.

But when we run hiera from the command line,

hiera some::var hostname=foo

it doesn't find values values for "some::var" set in "servers/foo.yaml". Adding the -d (debug) option shows that it doesn't even look at that file. Instead, it says something like:

Looking for data source services/foo
Cannot find database /etc/puppet/hiera/services/foo.yaml, skipping

So ... (more)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by robrwo
close date 2013-09-25 04:35:09.817215

2 Answers

Sort by ยป oldest newest most voted

answered 2013-09-19 11:21:43 -0500

Ancillas gravatar image

Hiera will source different config files when invoked by Puppet, versus when it's invoked on the command line. The trick I've found is to symlink /etc/hiera.yaml to /etc/puppet/hiera.yaml.

edit flag offensive delete link more

answered 2013-09-19 11:46:20 -0500

robrwo gravatar image

I've realized what the problem was: from the command-line, I needed to add the -c option to specify where the hiera.yaml file was. Also, I needed to use %{hostname} instead of %{::hostname} in the configuration.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-09-19 08:15:47 -0500

Seen: 208 times

Last updated: Sep 19 '13