ansible-edda/playbooks/roles/music/rip/tasks/include/libvirt.yml

47 lines
1.1 KiB
YAML

---
- name: "libvirt : install libvirt"
ansible.builtin.apt:
name:
- "dnsmasq"
- "libvirt-daemon-system"
- "netcat"
- "qemu-system"
install_recommends: false
register: music_rip_libvirt_install
- name: "libvirt : install zfs storage driver for libvirt"
ansible.builtin.apt:
name:
- "libvirt-daemon-driver-storage-zfs"
when:
"'zfs' in group_names"
register: music_rip_libvirt_zfs_install
- name: "libvirt : enable libvirtd"
ansible.builtin.systemd:
name: "libvirtd"
enabled: true
- name: "libvirt : start libvirtd"
ansible.builtin.systemd:
name: "libvirtd"
state: "started"
register: music_rip_libvirt_start
- name: "libvirt : restart libvirtd"
ansible.builtin.systemd:
name: "libvirtd"
state: "restarted"
when:
(music_rip_libvirt_install.changed or
(music_rip_libvirt_zfs_install is defined and
music_rip_libvirt_zfs_install.changed)) and
not music_rip_libvirt_start.changed
- name: "libvirt : add {{ music_user_name }} to group \"libvirt\""
ansible.builtin.user:
name: "{{ music_user_name }}"
groups: "libvirt"
append: true