---

- name: remove vm
  ovirt_vm:
    auth: "{{ ovirt_auth }}"
    cluster: "{{ providers.ovirt.cluster }}"
    name: "{{ template.name }}"
    state: absent
  async: 7200
  poll: 0
  register: undeploy
  when: template is defined

- name: wait for template deletion to complete
  async_status:
    jid: "{{ undeploy.ansible_job_id }}"
  register: instance
  until: instance.finished
  retries: "{{ instance_wait_retry_limit }}"
  delay: 10