Files
fedora-infra_ansible/playbooks/ssh_host_keys.yml
2024-11-25 19:04:25 +10:00

18 lines
629 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