connection: ssh: Use individuals' host variables for physical host IP

It appears that since Ansible 2.4 the 'hostvars' variable does not
contain the host variables set by the linear plugin. However, the
physical_host_addrs variable set by that plugin is already present on
the host we are interested in. As such we can obtain that variable by
simply using the get_vars() method on the Host object.

Change-Id: Ibe2cff5fabf23e5ba6d5d165fb5406bca690a1e2
This commit is contained in:
Markos Chandras 2018-01-11 17:25:05 +00:00
parent c665f9f2a2
commit cbd43992bd
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ class Connection(SSH.Connection):
def set_host_overrides(self, host, hostvars=None, templar=None):
if self._container_check() or self._chroot_check():
physical_host_addrs = hostvars.get('physical_host_addrs', {})
physical_host_addrs = host.get_vars().get('physical_host_addrs', {})
physical_host_addr = physical_host_addrs.get(self.physical_host,
self.physical_host)
self.host = self._play_context.remote_addr = physical_host_addr