2 - name: Define virtual network - {{ ocloud_net_name }}
3 community.libvirt.virt_net:
5 name: "{{ ocloud_net_name }}"
6 xml: '{{ lookup("template", "virt_net.xml.j2") }}'
10 - name: Activate virtual network - {{ ocloud_net_name }}
11 community.libvirt.virt_net:
12 name: "{{ ocloud_net_name }}"
17 - name: Configure virtual network to auto-start - {{ ocloud_net_name }}
18 community.libvirt.virt_net:
19 name: "{{ ocloud_net_name }}"
24 - name: Locate qemu-kvm emulator
27 register: ocloud_infra_vm_emulator_stat
30 - /usr/libexec/qemu-kvm
33 ocloud_infra_vm_emulator_path: "{{ item.stat.path }}"
34 when: item.stat.exists
35 loop: "{{ ocloud_infra_vm_emulator_stat.results }}"
37 - name: Create virtual machine - {{ inventory_hostname }}
38 community.libvirt.virt:
40 xml: '{{ lookup("template", "virt.xml.j2") }}'
41 register: ocloud_infra_vm_definition
44 - name: Create VM disk
45 ansible.builtin.command:
46 cmd: "qemu-img create -f qcow2 {{ ocloud_infra_vm_disk_path }} {{ ocloud_infra_vm_disk_gb }}G"
47 when: ocloud_infra_vm_definition.changed
50 - name: Copy platform boot image
52 src: "{{ ocloud_platform_image }}"
53 dest: "{{ ocloud_infra_vm_image }}"
55 when: ocloud_infra_vm_definition.changed
58 - name: Activate virtual machine - {{ inventory_hostname }}
59 community.libvirt.virt:
60 name: "{{ inventory_hostname }}"
62 notify: monitor_platform_deployment