From 1efa0220c3ccf88b4b88ab9054126fb247326c4e Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 29 Nov 2021 14:05:20 +0100 Subject: [PATCH] tasks/aws_cloud.yml: hack with known_hosts removal We observed a situation when two keys were specified in known_hosts, and only one was removed by the playbook. At least we think this is what is actually happening. --- tasks/aws_cloud.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/aws_cloud.yml b/tasks/aws_cloud.yml index 4d20ad3be2..c09ad9c690 100644 --- a/tasks/aws_cloud.yml +++ b/tasks/aws_cloud.yml @@ -14,12 +14,16 @@ local_action: known_hosts path={{item}} host={{ inventory_hostname }} state=absent + # HACK! We repeat this task 3 times. We assume that "known_hosts" module is + # broken, and it removes only the first host key available (not all of them). with_items: - /root/.ssh/known_hosts + - /root/.ssh/known_hosts + - /root/.ssh/known_hosts when: birthday is defined - name: gather the temporary ssh host key from the new instance - local_action: command ssh-keyscan -t ssh-ed25519 {{ inventory_hostname }} + local_action: command ssh-keyscan -t rsa {{ inventory_hostname }} register: hostkey when: birthday is defined