infra-vagrant-host/ansible/tasks/libvirt.yml
2023-02-17 15:48:29 +01:00

34 lines
701 B
YAML

---
- name: Install LibVirt dependencies
apt:
name:
- qemu
- libvirt-daemon-system
- libvirt-daemon-config-network
- libvirt-dev
- ebtables
- libguestfs-tools
state: present
- name: Test libvirt default network
shell: virsh net-list | grep -q default
register: virsh_net_test
ignore_errors: true
changed_when: false
- ansible.builtin.service:
name: libvirtd
state: restarted
when: virsh_net_test.rc != 0
- name: Autostart libvirt default network
command:
cmd: virsh net-autostart default
when: virsh_net_test.rc != 0
- name: Start default network
command:
cmd: virsh net-start default
when: virsh_net_test.rc != 0
#