Fixing role param precedence issues

* Make role param resolution follow the role dependency chain, rather
  than using all roles within the play
* Also move params to be merged in after role vars in general, to match
  our variable precedence rules
* Changes to the way var lookup is done in role helper methods for
  get_vars(), get_inherited_vars(), and get_role_params() to make the
  above possible without trampling on previously merged vars

Fixes #14472
Fixes #14475
This commit is contained in:
James Cammarata 2016-03-20 10:38:18 -04:00
commit 9d2fe2fb2c
2 changed files with 9 additions and 9 deletions

View file

@ -308,12 +308,12 @@ class VariableManager:
if not C.DEFAULT_PRIVATE_ROLE_VARS:
for role in play.get_roles():
all_vars = combine_vars(all_vars, role.get_role_params())
all_vars = combine_vars(all_vars, role.get_vars(include_params=False))
if task:
if task._role:
all_vars = combine_vars(all_vars, task._role.get_vars())
all_vars = combine_vars(all_vars, task._role.get_role_params(task._block._dep_chain))
all_vars = combine_vars(all_vars, task.get_vars())
if host: