known_hosts
fileNew in version 1.9.
The known_hosts module lets you add or remove a host from the known_hosts
file. This is useful if you’re going to want to use the git module over ssh, for example. If you have a very large number of host keys to manage, you will find the template module more useful.
parameter | required | default | choices | comments |
---|---|---|---|---|
key |
no | The SSH public host key, as a string (required if state=present, optional when state=absent, in which case all keys for the host are removed) | ||
name |
yes | The host to add or remove (must match a host specified in key) aliases: host | ||
path |
no | (homedir)+/.ssh/known_hosts | The known_hosts file to edit | |
state |
no | present |
|
present to add the host, absent to remove it. |
# Example using with_file to set the system known_hosts file - name: tell the host about our servers it might want to ssh to known_hosts: path='/etc/ssh/ssh_known_hosts' name='foo.com.invalid' key="{{ lookup('file', 'pubkeys/foo.com.invalid') }}"
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.