From 0ed8f5f405c88a5a42d4332b977e363ca2e08a87 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 21 Nov 2023 13:53:36 +0100 Subject: [PATCH] aws_cloud: try to load and hack-around all host keys --- tasks/aws_cloud.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tasks/aws_cloud.yml b/tasks/aws_cloud.yml index 719bf5eca8..39f7347822 100644 --- a/tasks/aws_cloud.yml +++ b/tasks/aws_cloud.yml @@ -21,13 +21,18 @@ - name: gather the temporary ssh host key from the new instance local_action: command ssh-keyscan -t rsa {{ inventory_hostname }} register: hostkey + loop: + - rsa + - ecdsa + - ed25519 when: birthday is defined - name: add new ssh host key (until we can sign it) - local_action: known_hosts path={{item}} key="{{ hostkey.stdout }}" + local_action: known_hosts path={{item.0}} key="{{ item.1.stdout }}" host={{ inventory_hostname }} state=present - with_items: - - /root/.ssh/known_hosts + with_nested: + - [/root/.ssh/known_hosts] + - "{{ hostkey.results }}" when: birthday is defined # from https://github.com/praiskup/ansible-role-fix-root-ssh