mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Revert "Vars specified via CLI have the highest priority."
Reverting as this as reported allows some variables to clobber each other.
We'll work on a different fix.
This reverts commit c5469f6367
.
This commit is contained in:
parent
5020af0a45
commit
109632e3bc
2 changed files with 9 additions and 10 deletions
|
@ -663,19 +663,17 @@ You have already learned about inventory host and group variables, 'vars', and '
|
||||||
If a variable name is defined in more than one place with the same name, priority is as follows
|
If a variable name is defined in more than one place with the same name, priority is as follows
|
||||||
to determine which place sets the value of the variable.
|
to determine which place sets the value of the variable.
|
||||||
|
|
||||||
1. Variables specified via command line with --extra-vars.
|
1. Variables loaded from YAML files mentioned in 'vars_files' in a playbook.
|
||||||
|
|
||||||
2. Variables loaded from YAML files mentioned in 'vars_files' in a playbook.
|
2. 'vars' as defined in the playbook.
|
||||||
|
|
||||||
3. 'vars' as defined in the playbook.
|
3. facts, whether built in or custom, or variables assigned from the 'register' keyword.
|
||||||
|
|
||||||
4. facts, whether built in or custom, or variables assigned from the 'register' keyword.
|
4. variables passed to parameterized task include statements.
|
||||||
|
|
||||||
5. variables passed to parameterized task include statements.
|
5. Host variables from inventory.
|
||||||
|
|
||||||
6. Host variables from inventory.
|
6. Group variables from inventory, in order of least specific group to most specific.
|
||||||
|
|
||||||
7. Group variables from inventory, in order of least specific group to most specific.
|
|
||||||
|
|
||||||
Therefore, if you want to set a default value for something you wish to override somewhere else, the best
|
Therefore, if you want to set a default value for something you wish to override somewhere else, the best
|
||||||
place to set such a default is in a group variable.
|
place to set such a default is in a group variable.
|
||||||
|
|
|
@ -189,8 +189,9 @@ class Play(object):
|
||||||
else:
|
else:
|
||||||
raise errors.AnsibleError("'vars_prompt' section is malformed, see docs")
|
raise errors.AnsibleError("'vars_prompt' section is malformed, see docs")
|
||||||
|
|
||||||
vars.update(self.playbook.extra_vars)
|
results = self.playbook.extra_vars.copy()
|
||||||
return vars
|
results.update(vars)
|
||||||
|
return results
|
||||||
|
|
||||||
# *************************************************
|
# *************************************************
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue