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 d527be8a52)

Co-authored-by: James Spurin <james@spurin.com>
pull/76391/head
Vlad Mencl 3 years ago committed by GitHub
parent 02716851db
commit d945c66b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- set ssh host_key_checking defaults to True, restoring original behaviour (https://github.com/ansible/ansible/issues/75168)

@ -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")

Loading…
Cancel
Save