---

- name: wait for vm status to be poweredoff
  ovirt_vm_info:
    auth: "{{ ovirt_auth }}"
    pattern: name={{ template.name }} and cluster={{ providers.ovirt.cluster }}
  register: ovirt_vm_info_result
  until:
    - ovirt_vm_info_result.ovirt_vms is defined
    - ovirt_vm_info_result.ovirt_vms|length > 0
    - ovirt_vm_info_result.ovirt_vms[0].status == 'down'
  delay: 5
  retries: 30