mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
module.run_command is intended to bypass the shell here, so can't do ">>"
This commit is contained in:
@@ -91,8 +91,10 @@ def add_host_key(module, fqdn, key_type="rsa"):
|
||||
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)
|
||||
this_cmd = "%s -t %s %s" % (keyscan_cmd, key_type, fqdn)
|
||||
|
||||
rc, out, err = module.run_command(this_cmd)
|
||||
module.append_to_file("~/.ssh/known_hosts", out)
|
||||
|
||||
return rc, out, err
|
||||
|
||||
|
||||
Reference in New Issue
Block a user