From 20c1cf41a40a1817795626234aaf46bf8fe47789 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 15 Oct 2018 16:07:52 -0500 Subject: [PATCH] [stable-2.7] Use the copied and merged task for calculating task vars in the free strategy. Fixes #47024 (#47060) (cherry picked from commit c3d5779) Co-authored-by: Matt Martz --- changelogs/fragments/free-strategy-include-var-tags.yaml | 2 ++ lib/ansible/plugins/strategy/free.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/free-strategy-include-var-tags.yaml diff --git a/changelogs/fragments/free-strategy-include-var-tags.yaml b/changelogs/fragments/free-strategy-include-var-tags.yaml new file mode 100644 index 00000000000..b2b3665d137 --- /dev/null +++ b/changelogs/fragments/free-strategy-include-var-tags.yaml @@ -0,0 +1,2 @@ +bugfixes: +- dynamic includes - Use the copied and merged task for calculating task vars in the free strategy (https://github.com/ansible/ansible/issues/47024) diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index 207f63207be..f83e38cb63a 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -237,7 +237,7 @@ class StrategyModule(StrategyBase): continue for new_block in new_blocks: - task_vars = self._variable_manager.get_vars(play=iterator._play, task=included_file._task) + task_vars = self._variable_manager.get_vars(play=iterator._play, task=new_block._parent) final_block = new_block.filter_tagged_tasks(play_context, task_vars) for host in hosts_left: if host in included_file._hosts: