Initial commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
|
||||
---
|
||||
|
||||
- name: Install KVM and virtualization tools
|
||||
package:
|
||||
name:
|
||||
- qemu-kvm
|
||||
- libvirt-daemon-system
|
||||
- libvirt-clients
|
||||
- bridge-utils
|
||||
- virtinst
|
||||
- virt-manager
|
||||
- libguestfs-tools
|
||||
- xz-utils
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
|
||||
- name: Install KVM and virtualization tools (RedHat/Fedora)
|
||||
package:
|
||||
name:
|
||||
- qemu-kvm
|
||||
- libvirt
|
||||
- virt-install
|
||||
- virt-manager
|
||||
- libguestfs-tools
|
||||
- xz
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "RedHat"
|
||||
|
||||
- name: Install KVM and virtualization tools (Arch/CachyOS)
|
||||
package:
|
||||
name:
|
||||
- qemu-full
|
||||
- libvirt
|
||||
- virt-manager
|
||||
- iproute2
|
||||
- libguestfs
|
||||
- guestfs-tools
|
||||
- xz
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "Archlinux"
|
||||
|
||||
- name: Ensure libvirtd is started and enabled
|
||||
service:
|
||||
name: libvirtd
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: Ensure KVM default network is active and autostarts
|
||||
shell: |
|
||||
virsh net-start default || true
|
||||
virsh net-autostart default || true
|
||||
become: yes
|
||||
|
||||
- name: Add current user to libvirt group
|
||||
user:
|
||||
name: "{{ ansible_facts['user_id'] }}"
|
||||
groups: libvirt
|
||||
append: yes
|
||||
become: yes
|
||||
ignore_errors: yes # Some distros use different group names (e.g., kvm)
|
||||
Reference in New Issue
Block a user