2 - name: Install virtualization packages
4 name: ['qemu-kvm', 'libvirt-daemon-system', 'python3-libvirt', 'python3-lxml']
10 - name: Configure extra libvirt user groups
17 with_items: "{{libvirt_extra_users|default([])}}"
23 checksum: "{{item.checksum}}"
24 - name: Create VM disks
25 loop: "{{ lookup('vars', 'vms', default=[]) }}"
27 vm: "{{ vm_defaults | combine(item.vars) }}"
30 cmd: "qemu-img create -f qcow2 {{vm.disk}} {{vm.disk_capacity}}"
31 creates: "{{vm.disk}}"
33 # Note: is vm.uuid is not set and the template is changed, those changes will not be applied
34 # Note: many changes will require the VM to be destroyed then started again
35 community.libvirt.virt:
37 xml: "{{ lookup('template', item.template|default('vm_template.xml.j2')) }}"
39 loop: "{{ lookup('vars', 'vms', default=[]) }}"
41 vm: "{{ vm_defaults | combine(item.vars) }}"