diff --git a/tasks/aws_cloud.yml b/tasks/aws_cloud.yml index a4015306ec..015e0afbbf 100644 --- a/tasks/aws_cloud.yml +++ b/tasks/aws_cloud.yml @@ -10,16 +10,22 @@ changed_when: false check_mode: no -- name: gather ssh host key from new instance +- name: birthday=on - drop the old known host entries + local_action: known_hosts path={{item}} + host={{ inventory_hostname }} + state=absent + with_items: + - /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 rsa {{ inventory_hostname }} - ignore_errors: true register: hostkey when: birthday is defined - name: add new ssh host key (until we can sign it) local_action: known_hosts path={{item}} key="{{ hostkey.stdout }}" host={{ inventory_hostname }} state=present - ignore_errors: true with_items: - /root/.ssh/known_hosts when: birthday is defined