I set up roles and profiles with hiera.
Nodes are classifing is done in hiera with hiera_include and a custom role fact which assigns the role
If i have a host with facter set to role=mysql and subrole = slave, how do I get the role assigned to role.
Custom facts
/opt/puppetlabs/facter/facts.d/role.yaml
role: mysql
/opt/puppetlabs/facter/facts.d/subrole.yaml
subrole: slave
hiera.yaml
:hierarchy:
- "nodes/%{::trusted.certname}"
- "roles/%{::role}"
- common
site.pp
hiera_include('classes')
hieradata/roles/mysql.yaml
---
classes:
- profile::mysql
↧