diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index b1b8affce0b..0fa55774c41 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -40,8 +40,7 @@ def check_hostkey(module, fqdn): this_cmd = keygen_cmd + " -H -F " + fqdn rc, out, err = module.run_command(this_cmd) - if rc == 0: - if out != "": + if rc == 0 and out != "": result = True else: # Check the main system location