You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check all of these extensions when looking for 'variable' files which should be YAML or JSON or vaulted versions of these.
This affects vars_files, include_vars, inventory and vars plugins among others.
basedir
string
Default:
"hieradata"
ini entries:
[hieradata] basedir = hieradata
env:HIERADATA_BASE_DIR
The base directory where the hierarchy has to be placed in.
The base directory has to be placed within the inventory directory or playbook directory.
config
string
Default:
"hieradata.yml"
ini entries:
[hieradata] config = hieradata.yml
env:HIERADATA_CONFIG_FILE
Name of hieradata configuration file.
The hieradata configuration file has to be placed within the inventory dirctory or playbook directory.
hash_behavior
string
Choices:
merge ←
replace
ini entries:
[hieradata] hash_behavior = merge
env:HIERADATA_HASH_BEHAVIOR
This setting defines how hashes will be merged.
By default hieradata will merge hashes, so data only exists in higher precedence will be added to the data with lower precedence.
Higher precedence value will override lower precedence values.
You can define replace if you want to override data with lower precedence.
list_behavior
string
Choices:
append
append_rp
keep
prepend
prepend_rp
replace ←
ini entries:
[hieradata] list_behavior = replace
env:HIERADATA_HASH_BEHAVIOR
This setting defines how lists will be handled.
By default data with higher precedence will `replace` data with lower precedence.
You can also append or prepend data with higher precedence.
With replace you can override data with lower precedece by data with higher one.
stage
string
added in 2.10 of ansible.builtin
Choices:
all
task
inventory
ini entries:
[hieradata] stage = None
env:HIERADATA_VARS_PLUGIN_STAGE
Control when this vars plugin may be executed.
Setting this option to all will run the vars plugin after importing inventory and whenever it is demanded by a task.
Setting this option to task will only run the vars plugin whenever it is demanded by a task.
Setting this option to inventory will only run the vars plugin after parsing inventory.
If this option is omitted, the global RUN_VARS_PLUGINS configuration is used to determine when to execute the vars plugin.
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 }}"