Ask Your Question

How come Hiera returns "Could not find data item [...]"?

asked 2013-10-11 05:03:38 -0600

gertvdijk gravatar image

I'm trying to set up Hiera in Puppet, but I fail to get Hiera lookups working with separated environments.

Puppet version: 3.3.1, Hiera version: 1.2.1.


# snip
hiera_config = $confdir/environments/$environment/hiera.yaml

# snip
hiera_config = $confdir/environments/$environment/hiera.yaml

My /etc/puppet/environments/mypuppet/hiera.yaml:

  - yaml

  # some other hierarchies (irrelevant here)
  - common

  :datadir: /etc/puppet/environments/%{::environment}/hieradata

My /etc/puppet/environments/mypuppet/hieradata/common.yaml:

mymodule::common::myvar: myval
mymodule::common::myothervar: myotherval

In the manifests I have this in the node declaration:

class ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-11 14:55:25 -0600

Ancillas gravatar image

When I run puppet config print hiera_config as myself, versus sudo puppet config print hiera_config, I get different outputs respectively.

  • /home/greg/.puppet/hiera.yaml
  • /etc/puppet/environments/production/hiera.yaml

Any chance you're not getting the hiera.yaml file you're expecting?

edit flag offensive delete link more


The problem is indeed with the `hiera_config` value. I tried to include `$environment` in the path there, but that is unsupported. Feature request:

gertvdijk gravatar imagegertvdijk ( 2013-11-20 04:20:55 -0600 )edit

New link for the feature request (moved to JIRA):

gertvdijk gravatar imagegertvdijk ( 2014-08-27 04:15:44 -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: 2013-10-11 05:03:38 -0600

Seen: 4,373 times

Last updated: Oct 11 '13