Open tuxmea opened 2 years ago
Examples of a hiera.yaml file, which uses an additional data module to allow data overwrites. These examples are based on actual implementations at customers and might not be good to use with HDM.
Possible setup #1 - using a data git module with relative paths
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "Host specific"
paths:
- "../modules/hieradata_overrides/data/nodes/%{facts.fqdn}.yaml"
- "nodes/%{facts.fqdn}.yaml"
- name: "Per-datacenter business group data" # Uses custom facts.
paths:
- "../modules/hieradata_overrides/data/role/%{facts.role}.yaml"
- "role/%{facts.role}.yaml"
- name: "Global data"
path: "common.yaml"
Possible solutions for git_data in hdm.yaml
Possilbe solution #1 - a puppet module with data only.
production:
read_only: false
allow_encryption: true
puppet_db:
server: "http://localhost:8081"
config_dir: "/etc/puppetlabs/code"
git_data:
- path: "../modules/hieradata/data"
git_url: git@example.com:example/hieradata.git
path_in_repo: "data"
Possible setup #2 - using a data git repo with absolute paths
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "Host specific"
paths:
- "/etc/puppetlabs/code/data_overrides/nodes/%{facts.fqdn}.yaml"
- "nodes/%{facts.fqdn}.yaml"
- name: "Per-datacenter business group data" # Uses custom facts.
paths:
- "/etc/puppetlabs/code/data_overrides/role/%{facts.role}.yaml"
- "role/%{facts.role}.yaml"
- name: "Global data"
path: "common.yaml"
Possible solution #2 - a repo which gets cloned/updated to the Puppet Server
production:
read_only: false
allow_encryption: true
puppet_db:
server: "http://localhost:8081"
config_dir: "/etc/puppetlabs/code"
git_data:
- path: "/etc/puppetlabs/code/data_overrides"
git_url: git@example.com:example/hiera_data_overrides.git
path_in_repo: "."
Note: most setups use solution 1, as this allows automatic deployment of Puppet Code on git changes.
Provide an example hiera.yaml file which uses multiple hierarchies, where single path elements might be take from relative and absolute paths. This example should provide information about a hierarchy structure which uses data from hiera data (maybe control-repo data) and data from another git repo which overwrites data from control-repo.
Good starting point: https://github.com/tuxmea/hdm/pull/25#issuecomment-920749909