From 0f95a905d9a65960db043de0dd69a3e69a06aa22 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 24 Feb 2014 20:54:26 -0500 Subject: [PATCH] Fixes #5965 Ensure the inject for each item in a loop is un-altered --- lib/ansible/runner/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 39a65934951..5cef4344cc3 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -628,7 +628,9 @@ class Runner(object): all_failed = False results = [] for x in items: - inject['item'] = x + # use a fresh inject for each item + this_inject = inject.copy() + this_inject['item'] = x # TODO: this idiom should be replaced with an up-conversion to a Jinja2 template evaluation if isinstance(self.complex_args, basestring): @@ -640,7 +642,7 @@ class Runner(object): host, self.module_name, self.module_args, - inject, + this_inject, port, complex_args=complex_args )