host_group_vars – In charge of loading group_vars and host_vars

New in version 2.4.

Synopsis

  • Loads YAML vars into corresponding groups/hosts in group_vars/ and host_vars/ directories.
  • Files are restricted by extension to one of .yaml, .json, .yml or no extension.
  • Hidden (starting with ‘.’) and backup (ending with ‘~’) files and directories are ignored.
  • Only applies to inventory sources that are existing paths.
  • Starting in 2.10, this plugin requires whitelisting and is whitelisted by default.

Requirements

The below requirements are needed on the local master node that executes this vars.

  • whitelist in configuration

Parameters

Parameter Choices/Defaults Configuration Comments
_valid_extensions
list
Default:
[".yml", ".yaml", ".json"]
ini entries:

[yaml_valid_extensions]
defaults = ['.yml', '.yaml', '.json']

env:ANSIBLE_YAML_FILENAME_EXT
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.
stage
string
    Choices:
  • all
  • task
  • inventory
ini entries:

[vars_host_group_vars]
stage = VALUE

env:ANSIBLE_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.

Status

Authors

  • UNKNOWN

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.