New magic var: `ansible_config_file` (#66085)

* Add `ansible_config_file` magic variable

* Add ansible_config_file to INTERNAL_VARS

* Add changelog fragment

* Update Special Variables docs
pull/67323/head
Piotr Stawarski 4 years ago committed by GitHub
parent 29edcdcf5b
commit a0247d13d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- "new magic variable - ``ansible_config_file`` - full path of used Ansible config file"

@ -10,6 +10,9 @@ These variables cannot be set directly by the user; Ansible will always override
ansible_check_mode
Boolean that indicates if we are in check mode or not
ansible_config_file
The full path of used Ansible configuration file
ansible_dependent_role_names
The names of the roles currently imported into the current play as dependencies of other plays

@ -23,6 +23,7 @@ from ansible.vars.plugins import get_vars_from_inventory_sources, get_vars_from_
display = Display()
INTERNAL_VARS = frozenset(['ansible_diff_mode',
'ansible_config_file',
'ansible_facts',
'ansible_forks',
'ansible_inventory_sources',

@ -453,6 +453,7 @@ class VariableManager:
variables = {}
variables['playbook_dir'] = os.path.abspath(self._loader.get_basedir())
variables['ansible_playbook_python'] = sys.executable
variables['ansible_config_file'] = C.CONFIG_FILE
if play:
# This is a list of all role names of all dependencies for all roles for this play

Loading…
Cancel
Save