aboutsummaryrefslogtreecommitdiffstats
path: root/main/ansible/iteration-context.patch
blob: db2ed310423b88d33fee5f9807c4949311a08abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
diff -upr ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py ansible-2.0.0.2/lib/ansible/executor/task_executor.py
--- ansible-2.0.0.2.orig/lib/ansible/executor/task_executor.py	2016-02-04 00:51:21.944735819 +0100
+++ ansible-2.0.0.2/lib/ansible/executor/task_executor.py	2016-02-04 00:52:26.688134310 +0100
@@ -365,6 +365,9 @@ class TaskExecutor:
         if not self._connection or not getattr(self._connection, 'connected', False):
             self._connection = self._get_connection(variables=variables, templar=templar)
             self._connection.set_host_overrides(host=self._host)
+        # If connection is reused, its _play_context is no longer valid and needs to be replaced
+        # This fixes issues with tasks running sudo in a loop and having the success_key incorrect in the second iteration
+        self._connection._play_context = self._play_context
 
         self._handler = self._get_action_handler(connection=self._connection, templar=templar)