global_vars¶
Note
Always use the FQCN (Fully Qualified Collection Name) arista.avd.global_vars
when using this plugin.
Variable plugins to allow loading global_vars with less precedence than group_vars or host_vars
Synopsis¶
Loads variables from variable files specified in ansible.cfg or in the environment variable. Assign the loaded variables to the 'all' inventory group. Files are restricted by extension to one of .yaml, .json, .yml, or no extension. Hidden files (starting with '.') and backup files (ending with '~') are ignored. Only applies to inventory sources that are existing paths.
ansible.cfg only example¶
-
Enable the plugin in
ansible.cfg
- DO NOT REMOVEhost_group_vars
. -
Run your playbook
ansible.cfg + environment variable example¶
-
Enable the plugin in
ansible.cfg
- DO NOT REMOVEhost_group_vars
. -
Run your playbook
Requirements¶
The below requirements are needed on the host that executes this module.
- This plugin should run at the
inventory
stage (default) before all other variable plugins to inject the variables before any group and host vars.
Parameters¶
Argument | Type | Required | Default | Value Restrictions | Description |
---|---|---|---|---|---|
paths | list | True | None | List of relative paths relative to the inventory file. If path is a directory, all the valid files inside are loaded alphabetically. If the environment variable is set, it takes precedence over ansible.cfg. |
|
stage | any | optional | inventory | Valid values: - inventory |
The stage during which executing the plugin. It could be 'inventory' or 'task' Given the expected usage of this plugin at the beginning of the run. It is hard-coded to 'inventory' |
_valid_extensions | list | optional | [‘.yml’, ‘.yaml’, ‘.json’] | Check all of these extensions when looking for 'variable' files, which should be YAML, JSON, or vaulted versions. This affects vars_files, include_vars, inventory, and vars plugins, among others. |
Authors¶
- Arista Ansible Team (@aristanetworks)