Hiera and precedence

12 views
Skip to first unread message

Peter Berghold

unread,
Jan 17, 2019, 12:40:49 PM1/17/19
to puppet...@googlegroups.com
I'm having a revertment to my noob days with respect to how hiera works.  (Version 3 for now) 

If I have the hierarchy of 

- common
- nodes/"%{fqdn}"
- datacenter/"%{fdatacenter}"

if in common.yaml I have "module::parms::server: server1" and in nodes/myclient.yaml I have "module::parms::server: server2" and in datacenter/NYCA.yaml (and the host presents NYCA as its datacenter) I have "module::parms::server: server3" which value will be presented for host myclient? 

I could have sworn I read the lower down the list of hierarchy a value was it would override the one above it. I just read this morning that hiera stops at the first value it finds which is a bit of a problem for what I'm trying to accomplish.



--

Peter L. Berghold                       Salty....@gmail.com

http://science-fiction.berghold.net

Dan White

unread,
Jan 17, 2019, 1:17:43 PM1/17/19
to puppet...@googlegroups.com
I think you have it bass-ackwards 
https://puppet.com/docs/puppet/5.0/hiera_hierarchy.html

"Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."

Bill Waterson (Calvin & Hobbes)

--
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/CAArvnv0%2BApOXSmMJfTVOpLAH4%2Bx7uZ5dSa84mibO_%2BDr2yMD%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Henrik Lindberg

unread,
Jan 18, 2019, 5:22:10 AM1/18/19
to puppet...@googlegroups.com
On 2019-01-17 18:40, Peter Berghold wrote:
> I'm having a revertment to my noob days with respect to how hiera
> works.  (Version 3 for now)
>
> If I have the hierarchy of
>
> - common
> - nodes/"%{fqdn}"
> - datacenter/"%{fdatacenter}"
>
> if in common.yaml I have "module::parms::server: server1" and in
> nodes/myclient.yaml I have "module::parms::server: server2" and in
> datacenter/NYCA.yaml (and the host presents NYCA as its datacenter) I
> have "module::parms::server: server3" which value will be presented for
> host myclient?
>
> I could have sworn I read the lower down the list of hierarchy a value
> was it would override the one above it. I just read this morning that
> hiera stops at the first value it finds which is a bit of a problem for
> what I'm trying to accomplish.
>

Hiera has always gone from top to bottom in the list in hiera.yaml
and it returns the first found.

You want "common" (the default) to be last in the list.

- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages