|
|
|
|
@ -324,7 +324,7 @@ class Connection(ConnectionBase):
|
|
|
|
|
pass # file was not found, but not required to function
|
|
|
|
|
ssh.load_system_host_keys()
|
|
|
|
|
|
|
|
|
|
sock_kwarg = self._parse_proxy_command(port)
|
|
|
|
|
ssh_connect_kwargs = self._parse_proxy_command(port)
|
|
|
|
|
|
|
|
|
|
ssh.set_missing_host_key_policy(MyAddPolicy(self._new_stdin, self))
|
|
|
|
|
|
|
|
|
|
@ -340,30 +340,19 @@ class Connection(ConnectionBase):
|
|
|
|
|
|
|
|
|
|
# paramiko 2.2 introduced auth_timeout parameter
|
|
|
|
|
if LooseVersion(paramiko.__version__) >= LooseVersion('2.2.0'):
|
|
|
|
|
ssh.connect(
|
|
|
|
|
self._play_context.remote_addr.lower(),
|
|
|
|
|
username=self._play_context.remote_user,
|
|
|
|
|
allow_agent=allow_agent,
|
|
|
|
|
look_for_keys=self.get_option('look_for_keys'),
|
|
|
|
|
key_filename=key_filename,
|
|
|
|
|
password=self._play_context.password,
|
|
|
|
|
timeout=self._play_context.timeout,
|
|
|
|
|
auth_timeout=self._play_context.timeout,
|
|
|
|
|
port=port,
|
|
|
|
|
**sock_kwarg
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
ssh.connect(
|
|
|
|
|
self._play_context.remote_addr.lower(),
|
|
|
|
|
username=self._play_context.remote_user,
|
|
|
|
|
allow_agent=allow_agent,
|
|
|
|
|
look_for_keys=self.get_option('look_for_keys'),
|
|
|
|
|
key_filename=key_filename,
|
|
|
|
|
password=self._play_context.password,
|
|
|
|
|
timeout=self._play_context.timeout,
|
|
|
|
|
port=port,
|
|
|
|
|
**sock_kwarg
|
|
|
|
|
)
|
|
|
|
|
ssh_connect_kwargs['auth_timeout'] = self._play_context.timeout
|
|
|
|
|
|
|
|
|
|
ssh.connect(
|
|
|
|
|
self._play_context.remote_addr.lower(),
|
|
|
|
|
username=self._play_context.remote_user,
|
|
|
|
|
allow_agent=allow_agent,
|
|
|
|
|
look_for_keys=self.get_option('look_for_keys'),
|
|
|
|
|
key_filename=key_filename,
|
|
|
|
|
password=self._play_context.password,
|
|
|
|
|
timeout=self._play_context.timeout,
|
|
|
|
|
port=port,
|
|
|
|
|
**ssh_connect_kwargs
|
|
|
|
|
)
|
|
|
|
|
except paramiko.ssh_exception.BadHostKeyException as e:
|
|
|
|
|
raise AnsibleConnectionFailure('host key mismatch for %s' % e.hostname)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|