ansible-desktop/roles/virtual/tasks/libvirt.yml

55 lines
1.1 KiB
YAML

---
- name: "[Ubuntu] install libvirt packages"
when: ansible_distribution == "Ubuntu"
become: yes
apt:
update_cache: yes
pkg:
- virt-viewer
- virt-manager
- qemu-kvm
- libvirt-daemon-system
- libvirt-clients
- bridge-utils
- name: "[Arch] install libvirt packages"
become: yes
community.general.pacman:
name:
- dnsmasq
- qemu-full
- libvirt
- virt-manager
- virt-viewer
- name: "[Ubuntu] ensure that your user is added to the group libvirtd"
when: ansible_distribution == "Ubuntu"
become: yes
user:
name: "{{ ansible_user_id }}"
append: yes
groups: libvirt, kvm
- name: "[Arch] ensure that your user is added to the group libvirtd"
when: ansible_distribution == "Ubuntu"
become: yes
user:
name: "{{ ansible_user_id }}"
append: yes
groups:
- libvirt-qemu
- qemu
- name: "[All] Enable service"
become: yes
ansible.builtin.systemd:
name: libvirtd
state: started
enabled: yes
- name: "[All] enable default network"
become: yes
shell:
cmd: |
virsh net-autostart default
virsh net-start default