I'm trying to use a node scope variable in my hiera.yaml config, which apparently should be relatively simple, but it's just not working for me Lol
With the hiera.yaml like this:
---
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/hieradata
:hierarchy:
- nodes/%{::hostname}
- builds/%{build}
- common
And my site.pp like so:
hiera_include('classes')
node 'mynode' {
$build = special
}
And the other yaml files,
common.yaml:
---
classes:
- first_class
- second_class
builds/special.yaml:
---
classes:
- third_class
I would expect 'mynode' to get the 'third_class' when the puppet agent is refreshed, but it doesn't, and gives no error.
Running the hiera command gives me the correct (I think) output:
$ hiera classes
["first_class","second_class"]
$ hiera classes build=special
["third_class"]
Is there something glaringly obvious that I've done wrong here?
The %{::hostname}
works. If I add nodes/mynode.yaml, that config is picked up.