Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working from puppet but working from hiera directly #18

Closed
amartinj opened this issue Feb 1, 2013 · 4 comments
Closed

Not working from puppet but working from hiera directly #18

amartinj opened this issue Feb 1, 2013 · 4 comments

Comments

@amartinj
Copy link

amartinj commented Feb 1, 2013

This is quite tricky. I've been searching the web for an answer but found nothing.
I have /etc/hiera.yaml as a symlink pointing /etc/puppet/hiera.yaml. I also have hiera_config=/etc/puppet/hiera.yaml in [master] section of /etc/puppet/puppet.conf.

My hiera config looks like this:

---
:backends:
  - gpg
  - yaml

:hierarchy:
  - common

:yaml:
  :datadir:
    - /etc/puppet/hieradata

:gpg:
  :datadir:
    - /etc/puppet/hieradata

When I run hiera locally either passing or not the config file with -c I get the correct value:

# hiera facebook.appId
012344556

But if I try to access a hiera value from puppet it doesn't fetch it unless set in /etc/puppet/hieradata/common.yaml:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item facebook.appId in any Hiera data file and no default supplied at /etc/puppet/modules/funddy-website/manifests/clone.pp:16 on node clone.funddy.com

I'm using Ubuntu's Puppet version 3.0.2-1 from puppetlabs deb repo. I'm using Hiera version, also from puppetlabs with version 1.1.2-1. I installed hiera-gpg from a gem and got version 1.1.0.

I've had a look at syslog and the only message I'm getting when trying from puppet is the following:

Feb  1 19:45:30 puppet puppet-master[9524]: Could not find data item facebook.appId in any Hiera data file and no default supplied at /etc/puppet/modules/funddy-website/manifests/clone.pp:16 on node clone

When accessing locally, since everything works just fine, no log messages are generated.

I guess this is not a bug, but I'm stuck here and don't know how to carry on

@amartinj amartinj closed this as completed Mar 9, 2013
@bunchc
Copy link

bunchc commented Aug 2, 2013

In the spirit of: http://xkcd.com/979/

I dug in a bit and found: http://comments.gmane.org/gmane.comp.sysutils.puppet.user/51019
After running in debug mode, we found that despite being configured to look elsewhere, it was looking for things in /var/lib/hiera/common.yaml, so that's where I put the config.

@santana
Copy link

santana commented Jun 19, 2014

Dear people from the future: check the permissions on files and directories under /etc/puppet/hieradata. You'll get the same error message if the puppet process cannot read those files.

@nvasudevan
Copy link

@santana Your trick worked! Thanks. The permission on the relevant yaml file under /etc/puppet/hieradata was set to 664 and changing it to 755 enabled puppet agent to look up the relevant fields.

@santana
Copy link

santana commented Jan 23, 2015

@nvasudevan given the sensitive nature of the data in /etc/puppet/hieradata, I prefer to make the puppet user/group own the directory and set the permissions so nobody else can read/write them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants