Makes host key checking the default behavior but can be disabled in ansible.cfg or by environment variable.

This commit is contained in:
Michael DeHaan 2013-07-03 16:47:20 -04:00
commit 9db4f7a9a6
5 changed files with 117 additions and 11 deletions

View file

@ -53,7 +53,10 @@ class Connection(object):
self.common_args += ["-o", "ControlMaster=auto",
"-o", "ControlPersist=60s",
"-o", "ControlPath=/tmp/ansible-ssh-%h-%p-%r"]
self.common_args += ["-o", "StrictHostKeyChecking=no"]
if not C.HOST_KEY_CHECKING:
self.common_args += ["-o", "StrictHostKeyChecking=no"]
if self.port is not None:
self.common_args += ["-o", "Port=%d" % (self.port)]
if self.private_key_file is not None: