fix for psuedo-connection hostvars not propagating to connection

(mostly done by jimi-c, tested working)
This commit is contained in:
nitzmahone 2016-06-10 10:13:53 -07:00
parent 04ce71b4bd
commit ece1ed09d5
3 changed files with 8 additions and 10 deletions

View file

@ -409,7 +409,7 @@ class TaskExecutor:
# get the connection and the handler for this execution
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)
self._connection.set_host_overrides(host=self._host, hostvars=variables.get('hostvars', {}).get(self._host.name, {}))
else:
# if connection is reused, its _play_context is no longer valid and needs
# to be replaced with the one templated above, in case other data changed