Ansible role to include custom YAML files from configured path(s).
- Ansible 2.3
hash_behaviour = merge
Just add the role to your requirements.yml
file:
- src: https://github.com/feffi/ansible-include-vars.git
name: ansible-include-vars
All role based variables are listed below, along with default values:
macos_include_vars:
# List of local paths to search for YAML files that will be included as Ansible vars.
paths:
- "{{ inventory_dir }}/.secrets"
# Extension of files to include.
extensions:
- "yml"
# Exclude files matching this names
excludes:
- "requirements.yml"
# Directory depth to used search for files
# 1 = only files directly in include_vars_dir_paths
depth: 1
None.
- hosts: all
vars:
# Include custom vars from defined locations
macos_include_vars: {
paths: [
"/Users/<USERNAME>/.secrets"
]
}
roles:
- { role: ansible-include-vars }