blob: 73dd7f6715fc224426bc882426515d12187836ea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
---
- name: "Install NVIDIA driver from AUR"
become: true
become_user: "aur_builder"
kewlfft.aur.aur:
name: "{{ nvidia_gtx1060_aur_packages }}"
state: "present"
use: "yay"
- name: "Install libva NVIDIA driver"
become: true
ansible.builtin.package:
name: "{{ nvidia_gtx1060_packages }}"
state: "present"
- name: "Configure NVIDIA DRM kernel mode setting"
become: true
ansible.builtin.template:
src: "nvidia.conf.j2"
dest: "/etc/modprobe.d/nvidia.conf"
mode: "0644"
notify:
- "Rebuild initramfs"
tags:
# Since the /etc/mkinitcpio isn't available on the docker container
# Ignore this for testing,
- "molecule-notest"
- name: "Get current mkinitcpio MODULES"
become: true
ansible.builtin.shell: |
set -euo pipefail
grep '^MODULES=' /etc/mkinitcpio.conf | sed 's/MODULES=(\(.*\))/\1/'
# noqa var-naming[no-role-prefix] as it describes the current kernel modules and not the nvidia modules
register: "current_kernel_modules"
changed_when: false
args:
executable: /bin/bash
tags:
# Since the /etc/mkinitcpio isn't available on the docker container
# Ignore this for testing,
- "molecule-notest"
- name: "Add NVIDIA modules to mkinitcpio"
become: true
vars:
existing_modules: "{{ current_kernel_modules.stdout.split() | reject('in', nvidia_gtx1060_modules) | list }}"
all_modules: "{{ existing_modules + nvidia_gtx1060_modules }}"
ansible.builtin.lineinfile:
path: "/etc/mkinitcpio.conf"
regexp: "^MODULES=\\(.*\\)"
line: "MODULES=({{ all_modules | join(' ') }})"
notify:
- "Rebuild initramfs"
tags:
# Since the /etc/mkinitcpio isn't available on the docker container
# Ignore this for testing,
- "molecule-notest"
|