ansible/playbooks/ssh_host_keys.yml
Ryan Lerch 2cf38c1f17 [yaml-lint] fix yamllint errors and warnings on plabooks
Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2024-11-25 19:04:25 +10:00

17 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