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.



-----Original message-----
From: Maruti Gangumolu <[email protected]>
Sent: Saturday 28th January 2017 10:02
To: Puppet Users <[email protected]>
Subject: [Puppet Users] Problem in looking up key value from hieradata

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.



-- 
 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 [email protected] 
<mailto:[email protected]> .
 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.
 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/zarafa.588f39a7.20ad.287536a667ca920a%40anjie.dontpanic.nl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to