--- - name: libvirt | Install libvirt and qemu community.general.apk: name: libvirt-daemon, qemu-img, qemu-system-x86_64, qemu-modules state: present # This is for PulseAudio - name: libvirt | Allow the normal user to interact with qemu system instance lineinfile: path: /etc/libvirt/qemu.conf owner: root group: root mode: 0644 regexp: '^#?user = "' line: 'user = "{{ username }}"' - name: libvirt | Use file-based permissions when polkit is not available lineinfile: path: /etc/libvirt/{{ item[0] }}.conf owner: root group: root mode: 0644 regexp: '^#?{{ item[1] | regex_replace(" =.*$", "") }}' line: '{{ item[1] }}' loop: '{{ libvirt_daemons | product(libvirt_daemons_conf) | list }}' when: not use_polkit - name: libvirt | Start modular services on runlevel 'default' service: name: '{{ item }}' runlevel: default enabled: true state: started loop: '{{ libvirt_daemons + ["virtlogd", "virtlockd"] }}'