Optimized virtualbox draft

This commit is contained in:
2025-07-23 21:18:09 +02:00
parent 0472fecd64
commit f5213fd59c
5 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
---
- name: Install VirtualBox and kernel modules
become: true
pacman:
name: >-
virtualbox
{{ lookup('pipe', "pacman -Qsq '^linux' | grep '^linux[0-9]*[-rt]*$' | awk '{print $1 \"-virtualbox-host-modules\"}' ORS=' '") }}
state: present
update_cache: true
- name: Load vbox kernel modules
become: true
command: vboxreload
register: vboxreload_output
failed_when: vboxreload_output.rc != 0 and '"vboxdrv"' not in vboxreload_output.stderr
- name: Build and install Oracle VirtualBox extension pack
become: true
command: pamac build --no-confirm virtualbox-ext-oracle
args:
creates: /usr/lib/virtualbox/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack
- name: Add current user to vboxusers group
become: true
user:
name: "{{ lookup('env','USER') }}"
groups: vboxusers
append: yes