diff options
| author | spmfox <spmfox@foxwd.com> | 2023-05-30 23:17:08 -0400 |
|---|---|---|
| committer | spmfox <spmfox@foxwd.com> | 2023-05-30 23:17:08 -0400 |
| commit | bdb2c566833ab8a98565fa5eb117995ae9b32592 (patch) | |
| tree | 4ce1df16537e6dac30645ca79366731434a82e8f | |
| parent | d2c138416d855a7a560569a4b9e20950ffe2e9a4 (diff) | |
adding a rescue, if the VM fails to be created then the dataset is destroyed
| -rw-r--r-- | vm-create.yml | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/vm-create.yml b/vm-create.yml index cfe9f8d..115be1d 100644 --- a/vm-create.yml +++ b/vm-create.yml @@ -21,8 +21,23 @@ apply: delegate_to: "{{ hypervisor_host }}" - - ansible.builtin.include_role: - name: libvirt - tasks_from: vm-install.yml - apply: - delegate_to: "{{ hypervisor_host }}" + - block: + - ansible.builtin.include_role: + name: libvirt + tasks_from: vm-install.yml + apply: + delegate_to: "{{ hypervisor_host }}" + + rescue: + - ansible.builtin.include_role: + name: zfs + tasks_from: dataset-confirm-info.yml + apply: + delegate_to: "{{ hypervisor_host }}" + + - ansible.builtin.include_role: + name: zfs + tasks_from: dataset-destroy.yml + apply: + delegate_to: "{{ hypervisor_host }}" + |
