known_hosts
Collection: builtin
Full Name: parallax.builtin.known_hosts
Aliases: ansible.builtin.known_hosts, known_hosts
Synopsis
Add or remove entries in a known_hosts file
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | The host to add or remove (must match a host specified in key) | |
| key | string | The SSH public host key, as a string | ||
| path | string | ~/.ssh/known_hosts | The known_hosts file to edit | |
| hash_host | bool | false | Hash the hostname in the known_hosts file | |
| state | string | present | Whether the given host’s fingerprint should be added or removed Choices: absent, present |
Example
- name: Trust the build server host key
known_hosts:
name: build.example.com
key: "build.example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyMaterialHere"
path: /etc/ssh/ssh_known_hosts
state: present