1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
infrastructure/roles/libvirt/tasks/main.yml
Kristian Klausen cc6195f3a2
gitlab_runner: Remove tight coupling to libvirt filesystem pool
All libvirt volume management is now handled through virsh instead of
direct file system access. As a volume cannot be uploaded in an atomic
way, the current active volume is now tracked in a file on disk.

This may allow us to run the script with less privileges and use polkit
for libvirt access control[1].

[1] https://libvirt.org/aclpolkit.html
2024-12-15 15:14:20 +01:00

44 lines
1.1 KiB
YAML

---
- name: Remove iptables to solve iptables<->iptables-nft conflict
pacman: name=iptables force=yes state=absent
- name: Install libvirt and needed optional dependencies
pacman:
state: present
name:
- dnsmasq
- iptables-nft
- libvirt
- qemu-base
- qemu-hw-display-virtio-gpu
- qemu-hw-display-virtio-vga
- libvirt-python
- python-lxml
register: result
- name: Reload firewalld
service: name=firewalld state=reloaded
when: result.changed
- name: Autostart default network on boot
file: src=/etc/libvirt/qemu/networks/default.xml dest=/etc/libvirt/qemu/networks/autostart/default.xml state=link owner=root group=root
- name: Start and enable libvirtd
systemd: name=libvirtd enabled=yes state=started daemon_reload=yes
- name: Define the images storage pool
community.libvirt.virt_pool:
command: define
name: images
xml: "{{ lookup('file', 'images.xml') }}"
- name: Start the image storage pool
community.libvirt.virt_pool:
state: active
name: images
- name: Start the image storage pool at boot
community.libvirt.virt_pool:
autostart: true
name: images