From 234807c27859e50340896c756c1d8b2df6e896a6 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 7 Jun 2025 18:41:58 -0500 Subject: [PATCH] Clean up ~/.ssh/known_hosts Signed-off-by: Jason Rothstein --- known_hosts.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 known_hosts.yml diff --git a/known_hosts.yml b/known_hosts.yml new file mode 100644 index 0000000..2a68492 --- /dev/null +++ b/known_hosts.yml @@ -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 +...