Problem in looking up key value from hieradata

29 views
Skip to first unread message

Maruti Gangumolu

unread,
Jan 28, 2017, 4:02:41 AM1/28/17
to Puppet Users
Hi All,

I want to integrate hiera with puppet conifguration tool for managing my data

This is my setup that I have

puppetmaster version = 3.6.2
hiera version = 1.3.4

This is what i defined in my puppet.conf configuration file of puppetmaster

hiera_config = /etc/puppet/hiera.yaml

This is how my hiera.yaml looks...

---
backends:
  - yaml
hierarchy:
  - node/%{::fqdn}
  - "%{::environment}"
  - global
yaml:
  datadir: /etc/puppet/hieradata

cd /etc/puppet/hieradata/node

[root@puppetmaster node]# cat puppetmaster.yaml 
---
webserver: puppetmaster

when trying to lookup hiera key value, I'm getting nil value. Could you please help me where I'm making mistakes?

[root@puppetmaster node]# hiera -d webserver ::node=puppetmaster
DEBUG: 2017-01-28 14:26:46 +0530: Hiera YAML backend starting
DEBUG: 2017-01-28 14:26:46 +0530: Looking up webserver in YAML backend
DEBUG: 2017-01-28 14:26:46 +0530: Looking for data source defaults
DEBUG: 2017-01-28 14:26:46 +0530: Cannot find datafile /var/lib/hiera/defaults.yaml, skipping
DEBUG: 2017-01-28 14:26:46 +0530: Looking for data source global
DEBUG: 2017-01-28 14:26:46 +0530: Cannot find datafile /var/lib/hiera/global.yaml, skipping
nil


Thanks,
Maruti.

Bart-Jan Vrielink

unread,
Jan 30, 2017, 8:58:39 AM1/30/17
to puppet...@googlegroups.com

Hello,


There are a few issues with your example that need to be fixed, to make it work.

As a start, you need to prefix certain keywords in /etc/hiera.yaml with a colon (:). I have tested using this setup:

---
:backends:
  - yaml
:hierarchy:
  - node/%{::fqdn}
  - "%{::environment}"
  - global
:yaml:
  :datadir: /etc/puppet/hieradata

Apart from that, you are querying hiera using the node=puppetmaster fact, but in /etc/hiera.yaml you are using the fact fqdn as one of the hierarchy parts. So, switching to using 'hiera webserver ::fqdn=puppetmaster' should work.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/921fe6ed-1386-4684-bf0a-3e2f626df8d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maruti Gangumolu

unread,
Jan 30, 2017, 4:18:24 PM1/30/17
to puppet...@googlegroups.com
Thanks you sir! It worked great:)

To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/VEFQf3sWRys/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/zarafa.588f39a7.20ad.287536a667ca920a%40anjie.dontpanic.nl.
Reply all
Reply to author
Forward
0 new messages