known_hosts
file¶New in version 1.9.
known_hosts
module lets you add or remove a host keys from the known_hosts
file.parameter | required | default | choices | comments |
---|---|---|---|---|
hash_host (added in 2.3) |
no | Hash the hostname in the known_hosts file | ||
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). The key must be in the right format for ssh (see sshd(1), section "SSH_KNOWN_HOSTS FILE FORMAT") | ||
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 key, absent to remove it. |
- 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') }}"
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is community maintained without core committer oversight.
For more information on what this means please read Module Support
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.