From f00a20491a8f30da3eb266b7ac42bf0f731869fe Mon Sep 17 00:00:00 2001 From: Martin Wohlert Date: Sat, 12 Jun 2021 21:19:08 +0200 Subject: [PATCH] bugfix: Auswurf der cidata.iso --- roles/virt_vm/tasks/create_vm.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/roles/virt_vm/tasks/create_vm.yml b/roles/virt_vm/tasks/create_vm.yml index 7d114a0..f7ad38f 100644 --- a/roles/virt_vm/tasks/create_vm.yml +++ b/roles/virt_vm/tasks/create_vm.yml @@ -71,23 +71,33 @@ shell: cmd: "ping -c 2 {{ ansible_host }}" register: pingcmd - retries: 12 + retries: 11 delay: 10 until: pingcmd.rc == 0 # CLOUD-INIT CLEANUP -- name: detach CI from vm - delegate_to: "{{ virt.host }}" - shell: - cmd: virsh change-media "{{ inventory_hostname }}" sda --eject - - name: shutdown VM delegate_to: "{{ virt.host }}" virt: name: "{{ inventory_hostname }}" state: shutdown +- name: wait for shutdown + delegate_to: "{{ virt.host }}" + virt: + name: "{{ inventory_hostname }}" + command: status + register: vmstate + retries: 11 + delay: 10 + until: vmstate.status == "shutdown" + +- name: detach CI from vm + delegate_to: "{{ virt.host }}" + shell: + cmd: virsh change-media "{{ inventory_hostname }}" sda --eject --config + - name: delete CI temp dir delegate_to: "{{ virt.host }}" file: