Skip to content

Commit

Permalink
Updating known_hosts module Docs (#58785)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedark3 authored and samccann committed Jul 11, 2019
1 parent 6e3d54a commit 17c8872
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/ansible/modules/system/known_hosts.py
Expand Up @@ -27,6 +27,7 @@
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 <hostname> or <ip> present in key attribute.
required: true
key:
description:
Expand All @@ -36,6 +37,8 @@
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 `<hostname[,IP]> ssh-rsa <pubkey>`
path:
description:
- The known_hosts file to edit
Expand All @@ -61,6 +64,13 @@
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
Expand Down

0 comments on commit 17c8872

Please sign in to comment.