aws_cloud: try to load and hack-around all host keys

This commit is contained in:
Pavel Raiskup 2023-11-21 13:53:36 +01:00
parent ad935bba81
commit 0ed8f5f405

View file

@ -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