From fb921042db9e03fc805c3a5e83c8cf564d5c2199 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 18 Oct 2016 15:26:46 -0400 Subject: [PATCH] properly propagate loop vars fixes #17966 (cherry picked from commit 99220a5f6cd2dd5af2903dce8cefeeb5ceaddf8f) --- lib/ansible/plugins/strategy/linear.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py index 95ca7a6f06b..c592824a057 100644 --- a/lib/ansible/plugins/strategy/linear.py +++ b/lib/ansible/plugins/strategy/linear.py @@ -295,13 +295,12 @@ class StrategyModule(StrategyBase): if 'skipped' in include_result and include_result['skipped'] or 'failed' in include_result and include_result['failed']: continue - role_vars = include_result.get('include_variables', dict()) - if loop_var and loop_var in include_result: - role_vars[loop_var] = include_result[loop_var] - display.debug("generating all_blocks data for role") new_ir = hr._task.copy() - new_ir.args.update(role_vars) + new_ir.vars.update(include_result.get('include_variables', dict())) + if loop_var and loop_var in include_result: + new_ir.vars[loop_var] = include_result[loop_var] + all_role_blocks.extend(new_ir.get_block_list(play=iterator._play, variable_manager=self._variable_manager, loader=self._loader)) if len(all_role_blocks) > 0: