# Revision history [back]

### define hiera layer in node yaml

I'm using hiera with puppet and try to setup a hierarchy using my own variables. Setting it up using the provided facts works fine, but I would like to insert another layer using a variable which is set per node in the node yaml definition.

The use case is this: I have systems deployed in the blue zone and now want to have systems in the yellow (DMZ) zone. Therefore, they need different configs, e.g. different ntp servers. I want to achieve this, by declaring the zone in the node yaml file and not using custom facts, because the machine does not know if it's in blue or yellow zone.

My hiera.yaml looks like this:

---
:backends:
- yaml
:hierarchy:
- "node/%{::fqdn}"
- "zone/%{zone}"
- "osfamily/%{::osfamily}"
- "common"

:yaml:


Now, osfamily and fqdn are default fact shipped with facter and work fine. The problem is the zone, which I want to declare like this:

yellownode.yaml

---
classes:
- user
zone:
- yellow


bluenode.yaml

---
classes:
- user
zone:
- blue


And then zone specific yamls look like this:

zone/bluezone.yaml

---
ntpserver: ntp.bluezone.com


zone/yellowzone.yaml

---
ntpserver: ntp.yellowzone.com


This way, I can have a zone layer in my hierarchy and do not have to state the ntp server (and many other values which are zone-specific) in the node definition, but only the zone type. Is this even possible? I'm not sure if it's working like I think, so I'm open for suggestions.