ansible: Add rootnodes in new cluster
[lttng-ci.git] / automation / ansible / roles / libvirt / tasks / main.yml
1 ---
2 - name: Install virtualization packages
3 apt:
4 name: ['qemu-kvm', 'libvirt-daemon-system', 'python3-libvirt']
5 - name: Run libvirtd
6 systemd:
7 name: libvirtd
8 enabled: true
9 state: started
10 - name: Configure extra libvirt user groups
11 ansible.builtin.user:
12 name: "{{item}}"
13 groups:
14 - libvirt
15 - libvirt-qemu
16 append: true
17 with_items: "{{libvirt_extra_users|default([])}}"
18 - name: Download ISOs
19 loop: "{{ isos }}"
20 get_url:
21 dest: "{{item.dest}}"
22 url: "{{item.url}}"
23 checksum: "{{item.checksum}}"
24 - name: Create VM disks
25 loop: "{{ lookup('vars', 'vms', default=[]) }}"
26 vars:
27 vm: "{{ vm_defaults | combine(item.vars) }}"
28 when: vm.disk != ""
29 shell:
30 cmd: "qemu-img create -f qcow2 {{vm.disk}} {{vm.disk_capacity}}"
31 creates: "{{vm.disk}}"
32 - name: Define VMs
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:
36 command: define
37 xml: "{{ lookup('template', item.template|default('vm_template.xml.j2')) }}"
38 autostart: true
39 loop: "{{ lookup('vars', 'vms', default=[]) }}"
40 vars:
41 vm: "{{ vm_defaults | combine(item.vars) }}"
This page took 0.043628 seconds and 4 git commands to generate.