Install hardware-specific packages

This commit is contained in:
2024-05-10 18:52:51 +02:00
parent 2678e2adfe
commit 828b38ec0f
4 changed files with 82 additions and 39 deletions

View File

@@ -2,6 +2,7 @@ font_size_1: 12
font_size_2: 12 font_size_2: 12
gpu: amd gpu: amd
cpu: amd
users: users:
- name: hannes - name: hannes

View File

@@ -2,6 +2,7 @@ font_size_1: 12
font_size_2: 12 font_size_2: 12
gpu: nvidia gpu: nvidia
cpu: intel
users: users:
- name: hannes-work - name: hannes-work

20
drivers.yml Normal file
View File

@@ -0,0 +1,20 @@
cpu:
amd:
- amd-ucode
intel:
- intel-ucode
gpu:
amd:
- mesa
- lib32-mesa
- xf86-video-amdgpu
- vulkan-radeon
- lib32-vulkan-radeon
- libva-mesa-driver
- lib32-libva-mesa-driver
- mesa-vdpau
- lib32-mesa-vdpau
nvidia:
- mesa
- lib32-mesa

View File

@@ -577,55 +577,76 @@
permit nopass nolog setenv {PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin} :sudonopw permit nopass nolog setenv {PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin} :sudonopw
become: true become: true
- name: gpu configuration - name: hardware-specific configuration
tags: tags:
- gpu - hardware
block: block:
- name: AMD configuration - name: read driver variables
when: machine.gpu == 'amd' include_vars:
file: drivers.yml
name: drivers
tags:
- always
- name: gpu configuration
tags:
- hardware:gpu
block: block:
- name: install AMDGPU packages - name: install AMD cpu packages
package: package:
name: name: "{{ drivers.cpu.amd }}"
- mesa
- lib32-mesa
- xf86-video-amdgpu
- vulkan-radeon
- lib32-vulkan-radeon
- libva-mesa-driver
- lib32-libva-mesa-driver
- mesa-vdpau
- lib32-mesa-vdpau
state: present state: present
become: true become: true
when: machine.cpu == 'amd'
- name: set AMDGPU options - name: install Intel cpu packages
copy:
owner: root
group: root
mode: "0600"
dest: /etc/X11/xorg.conf.d/20-amdgpu.conf
content: |
Section "Device"
Identifier "AMD"
Driver "amdgpu"
Option "VariableRefresh" "true"
Option "TearFree" "true"
EndSection
become: true
- name: Nvidia configuration
when: machine.gpu == 'nvidia'
block:
- name: install nouveau packages
package: package:
name: name: "{{ drivers.cpu.intel }}"
- mesa
- lib32-mesa
state: present state: present
become: true become: true
when: when: machine.cpu == 'intel'
- machine.gpu is defined
when:
- machine.cpu is defined
- name: gpu configuration
tags:
- hardware:gpu
block:
- name: AMD configuration
when: machine.gpu == 'amd'
block:
- name: install AMDGPU packages
package:
name: "{{ drivers.gpu.amd }}"
state: present
become: true
- name: set AMDGPU options
copy:
owner: root
group: root
mode: "0600"
dest: /etc/X11/xorg.conf.d/20-amdgpu.conf
content: |
Section "Device"
Identifier "AMD"
Driver "amdgpu"
Option "VariableRefresh" "true"
Option "TearFree" "true"
EndSection
become: true
- name: Nvidia configuration
when: machine.gpu == 'nvidia'
block:
- name: install nouveau packages
package:
name: "{{ drivers.gpu.gpu }}"
state: present
become: true
when:
- machine.gpu is defined
- set_fact: - set_fact:
users: "{{ machine.users }}" users: "{{ machine.users }}"