mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make sure tasks from a role see their defaults above all others
Fixes #12081
This commit is contained in:
parent
c2d5901e2d
commit
a341a8a093
1 changed files with 6 additions and 0 deletions
|
@ -183,6 +183,12 @@ class VariableManager:
|
||||||
for role in play.get_roles():
|
for role in play.get_roles():
|
||||||
all_vars = self._combine_vars(all_vars, role.get_default_vars())
|
all_vars = self._combine_vars(all_vars, role.get_default_vars())
|
||||||
|
|
||||||
|
# if we have a task in this context, and that task has a role, make
|
||||||
|
# sure it sees its defaults above any other roles, as we previously
|
||||||
|
# (v1) made sure each task had a copy of its roles default vars
|
||||||
|
if task and task._role is not None:
|
||||||
|
all_vars = self._combine_vars(all_vars, task._role.get_default_vars())
|
||||||
|
|
||||||
if host:
|
if host:
|
||||||
# next, if a host is specified, we load any vars from group_vars
|
# next, if a host is specified, we load any vars from group_vars
|
||||||
# files and then any vars from host_vars files which may apply to
|
# files and then any vars from host_vars files which may apply to
|
||||||
|
|
Loading…
Reference in a new issue