68 lines
1.4 KiB
YAML

---
- name: Display libvirt_server role
ansible.builtin.debug:
var: role_config
vars:
role_config:
tasks:
- Install libvirt deamon packages
- Start and enable libvirt deamon
- "Features: nested qemu"
- "Allowed {{ libvirt_server_group_name }} users: {{ libvirt_server_group_members | join(' ') }}"
tags:
- config_show
################################
# Base host setup
################################
- name: Install base package
package:
state: present
name:
- libvirt-daemon
- libvirt-daemon-system
- libvirt-clients
- python3-libvirt
- python3-lxml
- rsync
# - libvirt-python
# - lsof
# - policycoreutils-python
# - python-lxml
# - qemu-kvm
# - wget
################################
# Configure the host as libvirt hypervisor
################################
- name: Enable libvirt
service:
name: libvirtd
state: started
enabled: true
ignore_errors: "{{ ansible_check_mode }}"
- name: Copy local binaries
copy:
src: virt-disk-template.sh
dest: /usr/local/bin/virt-disk-template
mode: 0755
################################
# Configure group permissions
################################
- name: Ensure user belongs to specified group
user:
name: "{{ item }}"
groups: "{{ libvirt_server_group_name }}"
append: yes
loop: "{{ libvirt_server_group_members }}"