ansible.vars package¶
- 
ansible.vars.preprocess_vars(a)[source]¶ Ensures that vars contained in the parameter passed in are returned as a list of dictionaries, to ensure for instance that vars loaded from a file conform to an expected state.
- 
ansible.vars.strip_internal_keys(dirty)[source]¶ All keys stating with _ansible_ are internal, so create a copy of the ‘dirty’ dict and remove them from the clean one before returning it
- 
class 
ansible.vars.VariableManager[source]¶ Bases:
object- 
extra_vars¶ ensures a clean copy of the extra_vars are made
- 
options_vars¶ ensures a clean copy of the options_vars are made
- 
get_vars(loader, play=None, host=None, task=None, include_hostvars=True, include_delegate_to=True, use_cache=True)[source]¶ Returns the variables, with optional “context” given via the parameter for the play, host, and task.
The context can possibly result in different sets of variables being returned due to the additional context.
The order of precedence is:
- play->roles->get_default_vars (if there is a play context)
 - group_vars_files[host] (if there is a host context)
 - host_vars_files[host] (if there is a host context)
 - host->get_vars (if there is a host context)
 - fact_cache[host] (if there is a host context)
 - play vars (if there is a play context)
 - play vars_files (if there’s no host context, ignore file names that cannot be templated)
 - task->get_vars (if there is a task context)
 - vars_cache[host] (if there is a host context)
 - extra vars
 
- 
add_host_vars_file(path, loader)[source]¶ Loads and caches a host_vars file in the _host_vars_files dict, where the key to that dictionary is the basename of the file, minus the extension, for matching against a given inventory host name
- 
add_group_vars_file(path, loader)[source]¶ Loads and caches a host_vars file in the _host_vars_files dict, where the key to that dictionary is the basename of the file, minus the extension, for matching against a given inventory host name
- 
 
Submodules¶
ansible.vars.hostvars module¶
ansible.vars.unsafe_proxy module¶
- 
class 
ansible.vars.unsafe_proxy.AnsibleJSONUnsafeEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)[source]¶ Bases:
json.encoder.JSONEncoder