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
gpu: amd
cpu: amd
users:
- name: hannes

View File

@@ -2,6 +2,7 @@ font_size_1: 12
font_size_2: 12
gpu: nvidia
cpu: intel
users:
- 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
become: true
- name: gpu configuration
- name: hardware-specific configuration
tags:
- gpu
- hardware
block:
- name: AMD configuration
when: machine.gpu == 'amd'
- name: read driver variables
include_vars:
file: drivers.yml
name: drivers
tags:
- always
- name: gpu configuration
tags:
- hardware:gpu
block:
- name: install AMDGPU packages
- name: install AMD cpu packages
package:
name:
- mesa
- lib32-mesa
- xf86-video-amdgpu
- vulkan-radeon
- lib32-vulkan-radeon
- libva-mesa-driver
- lib32-libva-mesa-driver
- mesa-vdpau
- lib32-mesa-vdpau
name: "{{ drivers.cpu.amd }}"
state: present
become: true
when: machine.cpu == 'amd'
- 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
- name: install Intel cpu packages
package:
name:
- mesa
- lib32-mesa
name: "{{ drivers.cpu.intel }}"
state: present
become: true
when:
- machine.gpu is defined
when: machine.cpu == 'intel'
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:
users: "{{ machine.users }}"