From 33de7707c9027ace26ec62bff8f58717f4080538 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 11 May 2016 13:17:32 -0400 Subject: [PATCH] Do not include params when getting role vars in certain situations In VariableManager, we fetch the params specifically in the next step, so including them in the prior step is unnecessary and could lead to things being overridden in an improper order. In Block, we should not be getting the params for the role as they are included earlier via the VariableManager. Fixes #14411 --- lib/ansible/playbook/block.py | 2 +- lib/ansible/vars/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index 1c9569de8da..8b4a6c8a101 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -66,7 +66,7 @@ class Block(Base, Become, Conditional, Taggable): all_vars = self.vars.copy() if self._role: - all_vars.update(self._role.get_vars(self._dep_chain)) + all_vars.update(self._role.get_vars(self._dep_chain, include_params=False)) if self._parent_block: all_vars.update(self._parent_block.get_vars()) if self._task_include: diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 4496d20ab50..66b816df96a 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -324,7 +324,7 @@ class VariableManager: if task: if task._role: - all_vars = combine_vars(all_vars, task._role.get_vars()) + all_vars = combine_vars(all_vars, task._role.get_vars(include_params=False)) all_vars = combine_vars(all_vars, task._role.get_role_params(task._block._dep_chain)) all_vars = combine_vars(all_vars, task.get_vars())