From 17c88724abd898700beec5ef53a37bf1f1e1fd68 Mon Sep 17 00:00:00 2001 From: Kedar Kulkarni Date: Thu, 11 Jul 2019 11:41:57 -0400 Subject: [PATCH] Updating known_hosts module Docs (#58785) --- lib/ansible/modules/system/known_hosts.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ansible/modules/system/known_hosts.py b/lib/ansible/modules/system/known_hosts.py index 094fa48015e..e46bf3d9554 100644 --- a/lib/ansible/modules/system/known_hosts.py +++ b/lib/ansible/modules/system/known_hosts.py @@ -27,6 +27,7 @@ options: aliases: [ 'host' ] description: - The host to add or remove (must match a host specified in key). It will be converted to lowercase so that ssh-keygen can find it. + - Must match with or present in key attribute. required: true key: description: @@ -36,6 +37,8 @@ options: Specifically, the key should not match the format that is found in an SSH pubkey file, but should rather have the hostname prepended to a line that includes the pubkey, the same way that it would appear in the known_hosts file. The value prepended to the line must also match the value of the name parameter. + + Should be of format ` ssh-rsa ` path: description: - The known_hosts file to edit @@ -61,6 +64,13 @@ EXAMPLES = ''' path: /etc/ssh/ssh_known_hosts name: foo.com.invalid key: "{{ lookup('file', 'pubkeys/foo.com.invalid') }}" + +- name: Another way to call known_hosts + known_hosts: + hostname: host1.example.com # or 10.9.8.77 + key: host1.example.com,10.9.8.77 ssh-rsa ASDeararAIUHI324324 # some key gibberish + path: /etc/ssh/ssh_known_hosts + state: present ''' # Makes sure public host keys are present or absent in the given known_hosts