diff --git a/tasks/virt_instance_create.yml b/tasks/virt_instance_create.yml index 7565d2bb95..f0f20d7bb5 100644 --- a/tasks/virt_instance_create.yml +++ b/tasks/virt_instance_create.yml @@ -37,6 +37,21 @@ delegate_to: "{{ vmhost }}" when: inventory_hostname not in result.list_vms +- name: make sure there is no old ssh host key for the host still around + local_action: known_hosts path={{item}} host={{ inventory_hostname }} state=absent + ignore_errors: True + with_items: + - /root/.ssh/known_hosts + - /etc/ssh/ssh_known_hosts + when: inventory_hostname not in result.list_vms + +- name: Add new ssh_host_key for newly installed host + local_action: known_hosts path={{item}} host={{ inventory_hostname }} state=present + ignore_errors: True + with_items: + - /root/.ssh/known_hosts + when: inventory_hostname not in result.list_vms + - name: wait for ssh on the vm to start back local_action: wait_for delay=10 host={{ inventory_hostname }} port=22 state=started timeout=1200 when: inventory_hostname not in result.list_vms