- hosts: all become: true gather_facts: false tasks: - name: Import zfs role to check if dataset exists ansible.builtin.include_role: name: zfs tasks_from: dataset-check-exists.yml apply: tags: zfs delegate_to: "{{ hypervisor_host }}" tags: zfs - name: Import libvirt role to check if VM exists ansible.builtin.include_role: name: libvirt tasks_from: vm-check-exists.yml apply: tags: libvirt delegate_to: "{{ hypervisor_host }}" tags: libvirt - name: Import libvirt role to confirm if VM has expected configuration ansible.builtin.include_role: name: libvirt tasks_from: vm-confirm-info.yml apply: tags: libvirt delegate_to: "{{ hypervisor_host }}" tags: libvirt - name: Import zfs role to confirm if the dataset has expected configuration ansible.builtin.include_role: name: zfs tasks_from: dataset-confirm-info.yml apply: tags: zfs delegate_to: "{{ hypervisor_host }}" tags: zfs - name: Import guest-configure role for undo ansible.builtin.include_role: name: guest-configure tasks_from: undo.yml apply: tags: guest-configure tags: guest-configure when: (ssh_keys is defined and ssh_keys | length > 0) or (root_password is defined and root_password | length > 0) - name: Import libvirt role to undefine VM ansible.builtin.include_role: name: libvirt tasks_from: vm-undefine.yml apply: tags: libvirt delegate_to: "{{ hypervisor_host }}" tags: libvirt - name: Import zfs role to destroy the dataset ansible.builtin.include_role: name: zfs tasks_from: dataset-destroy.yml apply: tags: zfs delegate_to: "{{ hypervisor_host }}" tags: zfs