Fix with loop + delegate issues

* Don't re-use the existing connection if the remote_addr field of
  the play context has changed
* When overriding variables in PlayContext (from task/variables),
  don't set the same attribute based on a different variable name
  if we had already previously set it from another variable name

Fixes #13880
This commit is contained in:
James Cammarata 2016-01-18 17:32:25 -05:00
parent 1c9774785f
commit 1733d434d1
2 changed files with 6 additions and 1 deletions

View file

@ -367,7 +367,7 @@ class TaskExecutor:
self._task.args = variable_params
# get the connection and the handler for this execution
if not self._connection or not getattr(self._connection, 'connected', False):
if not self._connection or not getattr(self._connection, 'connected', False) or self._play_context.remote_addr != self._connection._play_context.remote_addr:
self._connection = self._get_connection(variables=variables, templar=templar)
self._connection.set_host_overrides(host=self._host)
else: