aboutsummaryrefslogtreecommitdiff
path: root/vm-create.yml
blob: 115be1d4bb3eee1e2f79a430e58a3ab29f5a4333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
- hosts: all
  become: true
  gather_facts: false

  tasks:
    - ansible.builtin.include_role:
        name: zfs
        tasks_from: dataset-check-duplicate.yml
        apply:
          delegate_to: "{{ hypervisor_host }}"

    - ansible.builtin.include_role:
        name: libvirt
        tasks_from: vm-check-duplicate.yml
        apply:
          delegate_to: "{{ hypervisor_host }}"

    - ansible.builtin.include_role:
        name: zfs
        tasks_from: dataset-create.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 }}"