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

56 lines
1.1 KiB
YAML
Raw Normal View History

2020-07-06 13:34:33 +00:00
---
2024-08-15 22:47:19 +00:00
- name: "[Ubuntu] install libvirt packages"
2024-01-10 14:11:23 +00:00
when: ansible_distribution == "Ubuntu"
2020-07-06 13:34:33 +00:00
become: yes
apt:
update_cache: yes
pkg:
- virt-viewer
- virt-manager
- qemu-kvm
- libvirt-daemon-system
- libvirt-clients
- bridge-utils
2024-08-15 22:47:19 +00:00
- name: "[Arch] install libvirt packages"
2024-01-10 14:11:23 +00:00
become: yes
community.general.pacman:
name:
2024-08-15 22:47:19 +00:00
- dnsmasq
2024-01-10 14:11:23 +00:00
- qemu-full
- libvirt
- virt-manager
- virt-viewer
2024-08-15 22:47:19 +00:00
- name: "[Ubuntu] ensure that your user is added to the group libvirtd"
when: ansible_distribution == "Ubuntu"
2020-07-06 13:34:33 +00:00
become: yes
user:
name: "{{ ansible_user_id }}"
append: yes
groups: libvirt, kvm
2024-01-10 14:11:23 +00:00
2024-08-15 22:47:19 +00:00
- 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"
2024-01-10 14:11:23 +00:00
become: yes
shell:
2024-08-15 22:47:19 +00:00
cmd: |
2024-01-10 14:11:23 +00:00
virsh net-autostart default
virsh net-start default