Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example hiera.yaml file with multiple hierachies #80

Open
tuxmea opened this issue Aug 23, 2022 · 1 comment
Open

Example hiera.yaml file with multiple hierachies #80

tuxmea opened this issue Aug 23, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@tuxmea
Copy link
Member

tuxmea commented Aug 23, 2022

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

@tuxmea tuxmea added the documentation Improvements or additions to documentation label Aug 23, 2022
@tuxmea tuxmea self-assigned this Aug 23, 2022
@tuxmea
Copy link
Member Author

tuxmea commented Aug 23, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants