One common problem that I see when working with clients with new puppet deployments in AWS is that their node specific hieradata is not properly populated based on the hostname. Most guides recommend setting the hiera hierarchy as follows:
---
:backends:
- eyaml
- yaml
:hierarchy:
- "node/%{::fqdn}"
- common
:yaml:
:datadir: /etc/puppet/hieradata
The problem with this approach is that you can define nodes without the FQDN and you must define your node-specific hiera yaml files with the FQDN. I see this as inconsistent and prone to error. To fix this, I change the hiera hierarchy to the following:
---
:backends:
- eyaml
- yaml
:hierarchy:
- "node/%{::hostname}"
- common
:yaml:
:datadir: /etc/puppet/hieradata
That will allow you to define nodes using their hostname and hiera data files as well.
Leave a Reply