codeaffen.hieradata.hieradata – Loads configuration from a hierarchical configuration structure
Note
This plugin is part of the codeaffen.hieradata collection (version 0.1.0).
To install it use: ansible-galaxy collection install codeaffen.hieradata
.
To use it in a playbook, specify: codeaffen.hieradata.hieradata
.
New in version 0.0.1: of codeaffen.hieradata
Synopsis
Loads YAML vars into corresponding hierarchy directories/files.
Loads only files with extension to one of .yaml, .json, .yml or no extension.
Starting in 0.0.1, this plugin requires explicit whitelisting via vars_plugins_enabled.
Requirements
The below requirements are needed on the local controller node that executes this vars.
whitelist in configuration
Parameters
Examples
# hieradata.yml.
# Each level in hierarchy can be a file or a directory.
hiera_vars:
role: "{{ entity.name.split('-').0 }}"
env: "{{ entity.name.split('-').2 }}"
hierarchy:
- common
- "{{ env }}"
- "{{ role }}"
- "{{ role }}-{{ env }}"
# hieradata organized with sub directories.
# Last part of path of each level can be a file or a directory.
hiera_vars:
role: "{{ entity.name.split('-').0 }}"
env: "{{ entity.name.split('-').2 }}"
hieradata:
hierarchy:
- common
- "environments/{{ env }}"
- "roles/{{ role }}"
- "roles/{{ role }}-{{ env }}"