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
This commit is contained in:
parent
29edcdcf5b
commit
a0247d13d8
4 changed files with 7 additions and 0 deletions
2
changelogs/fragments/66085-ansible_config_file.yml
Normal file
2
changelogs/fragments/66085-ansible_config_file.yml
Normal file
|
@ -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…
Add table
Reference in a new issue