I’ve spoke about this with people and tried with limited success in the past to integrate foreman hostgroups into the hiera eco-system. I know people have done it and speak positively about it and people also speak very negative about it, it’s all personal preference, I’ve really like to give this a go. I’ve posted it here in community as it’s not really a support/problem, more I can’t find any reliable working documents to actually set this up, so I’d like to try to build one (or be pointed at one that exists that I’ve not found.
I’ve now got a fully automatable crash and burn lab, so I’m happy to test things to progress this.
My current test setup is a Rocky 9.5 x86_64 host, running a single node foreman 3.13 full component install.
The puppet master is OpenSource / Perforce puppet 8.7 with puppet 8.10 agent.
My Hiera config for a puppet environment is pretty generic,
# Hiera 5 Global configuration file
version: 5
defaults:
data_hash: yaml_data
datadir: data
# hierarchy:
# - name: Common
# data_hash: yaml_data
hierarchy:
- name: "Per-node data" # Human-readable name.
path: "nodes/%{trusted.certname}.yaml" # File path, relative to datadir.
- name: "Per-OS defaults"
path: "os/%{facts.os.family}.yaml"
- name: "Per-OS Version Specific defaults"
path: "os/version/%{facts.os.name}-%{facts.os.release.major}.yaml"
- name: "Common data"
path: "common.yaml"
really basic, if you find something specific to a node use that, if you find something specific to an OS do that next, if you find something specific to a specific OS version, do that, other wise everyone gets everything in common.yaml
What I’d really like to do is try to emulate the roles / profiles model a little bit somewhere in between this hierarchy.
node → OS → OS Specific → App Major (role) → App Minor (profile) → Common
I’d like to a use or at least to try to use host groups to fill that app major/minor data.
eg:
hostgroup/everything/bind (major)/{master/slave}
so I could use the hostgroup bind to ensure common bind install / configuration, and the child hostgup of master/slave to config the bind service as a master or slave.
This works with a lot of usecases for me
hostgroup/webserver/{apache/nginx}/{sitename}
hostgroup/database/maria/{master/replica}
how do I go about approaching it so that the puppet master can use foreman hostgroups as a hiera datasource