Ask Your Question
1

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.

/etc/puppet/puppet.conf:

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

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

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

---
:backends:
  - yaml

:hierarchy:
  # some other hierarchies (irrelevant here)
  - common

:yaml:
  :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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

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

Comments

The problem is indeed with the `hiera_config` value. I tried to include `$environment` in the path there, but that is unsupported. Feature request: http://projects.puppetlabs.com/issues/11784

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

New link for the feature request (moved to JIRA): https://tickets.puppetlabs.com/browse/HI-46

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

Stats

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

Seen: 3,976 times

Last updated: Oct 11 '13