Updating known_hosts module Docs (#58785)

pull/58987/head
Kedar Kulkarni 5 years ago committed by Sandra McCann
parent 6e3d54ae81
commit 17c88724ab

@ -27,6 +27,7 @@ options:
aliases: [ 'host' ] aliases: [ 'host' ]
description: 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. - 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 <hostname> or <ip> present in key attribute.
required: true required: true
key: key:
description: 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 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 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. the value of the name parameter.
Should be of format `<hostname[,IP]> ssh-rsa <pubkey>`
path: path:
description: description:
- The known_hosts file to edit - The known_hosts file to edit
@ -61,6 +64,13 @@ EXAMPLES = '''
path: /etc/ssh/ssh_known_hosts path: /etc/ssh/ssh_known_hosts
name: foo.com.invalid name: foo.com.invalid
key: "{{ lookup('file', 'pubkeys/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 # Makes sure public host keys are present or absent in the given known_hosts

Loading…
Cancel
Save