mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Fixes #5750 Fail on missing ~/.ssh and ignore accept_hostkey if stricthoskeychecking is off
This commit is contained in:
parent
1584d8f01b
commit
3ec043ec17
2 changed files with 11 additions and 2 deletions
|
@ -59,6 +59,10 @@ def add_host_key(module, fqdn, key_type="rsa"):
|
|||
|
||||
result = False
|
||||
keyscan_cmd = module.get_bin_path('ssh-keyscan', True)
|
||||
|
||||
if not os.path.exists(os.path.expanduser("~/.ssh/")):
|
||||
module.fail_json(msg="%s does not exist" % os.path.expanduser("~/.ssh/"))
|
||||
|
||||
this_cmd = "%s -t %s %s >> ~/.ssh/known_hosts" % (keyscan_cmd, key_type, fqdn)
|
||||
rc, out, err = module.run_command(this_cmd)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue