summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Mencl <vladimir.mencl@reannz.co.nz>2021-11-25 07:21:54 +1300
committerGitHub <noreply@github.com>2021-11-24 10:21:54 -0800
commitd945c66b36ce1dbd47d7149311b33db2340bc873 (patch)
tree6dd7e20c73cd234009752ab10de7184609afd596
parent02716851dbedd5f0d6f8abc853e9b891144486e4 (diff)
downloadansible-d945c66b36ce1dbd47d7149311b33db2340bc873.tar.gz
set host_key_checking check to False, rather than if not (which captures False and None) (#75168) (#76206)
* set host_key_checking check to False, rather than if not (which captures False and None) * add host_key_checking default to ssh.py / update documentation (cherry picked from commit d527be8a524ff0f6bd23dfc48c6b511b9d14ddf8) Co-authored-by: James Spurin <james@spurin.com>
-rw-r--r--changelogs/fragments/set-ssh-host_key_checking-defaults.yaml2
-rw-r--r--lib/ansible/plugins/connection/ssh.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/changelogs/fragments/set-ssh-host_key_checking-defaults.yaml b/changelogs/fragments/set-ssh-host_key_checking-defaults.yaml
new file mode 100644
index 0000000000..45181cdc9f
--- /dev/null
+++ b/changelogs/fragments/set-ssh-host_key_checking-defaults.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - set ssh host_key_checking defaults to True, restoring original behaviour (https://github.com/ansible/ansible/issues/75168)
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index 3f812c1cb1..cc2aff8d12 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -33,6 +33,7 @@ DOCUMENTATION = '''
- name: delegated_vars['ansible_ssh_host']
host_key_checking:
description: Determines if ssh should check host keys
+ default: True
type: boolean
ini:
- section: defaults
@@ -666,7 +667,7 @@ class Connection(ConnectionBase):
self._add_args(b_command, b_args, u"ansible.cfg set ssh_args")
# Now we add various arguments that have their own specific settings defined in docs above.
- if not self.get_option('host_key_checking'):
+ if self.get_option('host_key_checking') is False:
b_args = (b"-o", b"StrictHostKeyChecking=no")
self._add_args(b_command, b_args, u"ANSIBLE_HOST_KEY_CHECKING/host_key_checking disabled")