ansible/playbooks/ssh_host_keys.yml
2016-07-18 19:03:17 +00:00

16 lines
625 B
YAML

- hosts: all
become: False
vars:
keyfile: /tmp/known_hosts
tasks:
- name: Add short name to file
local_action: shell ssh-keyscan -p {{ansible_port|default(22)}} -H {{inventory_hostname}} 2> /dev/null >> {{keyfile}}
ignore_errors: True
- name: Add FQDN to file
local_action: shell ssh-keyscan -p {{ansible_port|default(22)}} -H {{ansible_fqdn}} 2> /dev/null >> {{keyfile}}
ignore_errors: True
- name: Add IPv4 to file
local_action: shell ssh-keyscan -p {{ansible_port|default(22)}} -H {{ansible_default_ipv4.address}} 2> /dev/null >> {{keyfile}}
ignore_errors: True