Clean up ~/.ssh/known_hosts

Signed-off-by: Jason Rothstein <fdragon@fdragon.org>
This commit is contained in:
Jason Rothstein 2025-06-07 18:41:58 -05:00
parent 9dcbb0d0af
commit 234807c278
Signed by: jmrothst
GPG Key ID: 741BF3C536829D46

15
known_hosts.yml Normal file
View File

@ -0,0 +1,15 @@
---
- name: 'all'
hosts: 'all'
gather_facts: false
serial: 1
tasks:
- name: 'Remove known_host file entries'
delegate_to: 'localhost'
ansible.builtin.shell:
ssh-keygen -f ~/.ssh/known_hosts -R {{ inventory_hostname }}
- name: 'Add known_hosts file entries'
delegate_to: 'localhost'
ansible.builtin.shell:
ssh-keyscan {{ inventory_hostname }} >> ~/.ssh/known_hosts
...