Group nodes in hiera by hiera-defined fact

723 views Asked by At

I have a hierachy like this:

- "nodes/%{::certname}"
- (what's here is my question)
- common

I'd like to assign a group to my nodes in their individual configuration in hiera, like this in nodes/hostname.yaml :

---
group: alpha

Now, I'd like to have a file alpha.yaml, where I state group-specific settings.

So my question is how do I write the hierachy to ask hiera for the filename of the group definition?

Is there another way to achieve this?

1

There are 1 answers

0
BMW On BEST ANSWER

You can. Make sure you have the group defined in Facts.

- "nodes/%{::certname}"
- "%{::group}"
- common

So you can test with below command

FACTER_group=alpha puppet apply your.pp

For custom facts, you can go through this document: Custom Facts Walkthrough