homelab-server-v2/ansible/playbooks/02_kvm_setup.yml
2026-07-15 07:49:29 +00:00

34 lines
767 B
YAML

---
- name: Setup KVM Hypervisor and Cockpit
hosts: hypervisor
gather_facts: true
tasks:
- name: Install virtualization packages and Cockpit
become: true
ansible.builtin.dnf:
name:
- qemu-kvm
- libvirt
- virt-install
- cockpit
- cockpit-machines
state: present
- name: Add user to libvirt group
become: true
ansible.builtin.user:
name: "{{ admin_user }}"
groups: libvirt
append: true
- name: Ensure virtualization and cockpit services are active
become: true
ansible.builtin.systemd_service:
name: "{{ item }}"
state: started
enabled: true
loop:
- libvirtd
- cockpit.socket