ansible/roles/nvidia/tasks/main.yml
Sascha bc765668a6 sync: Inventory-Realabgleich + neue host_vars/roles/playbooks
Nachgezogener Arbeitsstand des Homelabs:
- neue host_vars (k3s-*, gluster-*, docmost, paperless, kometa, thelounge, satisfactory, wolfstack-vm)
- neue Rollen/Playbooks (net_watchdog, patchmon-agent, tc_ratelimit, sops-age, rotate-ssh-key, dns-doh, remove-postfix, checkrr-deploy)
- diverse Rollen-Updates (base, borg, dns_resolver, frp_client, hawser, nvidia)

Ausgeklammert (bleiben uncommittet): host_vars/docmost/vars.yml (Klartext-Token -> sollte vault-konform via vault_* referenziert werden).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:27:23 +02:00

78 lines
2.3 KiB
YAML

---
- name: Nouveau Treiber blacklisten
ansible.builtin.copy:
dest: /etc/modprobe.d/blacklist-nouveau.conf
content: |
blacklist nouveau
options nouveau modeset=0
mode: "0644"
register: nouveau_blacklist
- name: initramfs-tools installieren
apt:
name: initramfs-tools
state: present
- name: initramfs aktualisieren
ansible.builtin.command: update-initramfs -u
when: nouveau_blacklist.changed
- name: CUDA Keyring herunterladen und installieren
ansible.builtin.apt:
deb: "{{ cuda_keyring_deb_url }}"
- name: NVIDIA Container Toolkit GPG Key hinzufuegen
ansible.builtin.shell: |
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
args:
creates: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
- name: NVIDIA Container Toolkit Repo hinzufuegen
ansible.builtin.shell: |
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
args:
creates: /etc/apt/sources.list.d/nvidia-container-toolkit.list
- name: apt update
ansible.builtin.apt:
update_cache: true
- name: Kernel Headers und DKMS installieren
ansible.builtin.apt:
name:
- linux-headers-{{ ansible_kernel }}
- linux-headers-amd64
- dkms
state: present
- name: NVIDIA Treiber installieren (CUDA Repo)
ansible.builtin.apt:
name: cuda-drivers
state: present
register: nvidia_driver
- name: NVIDIA Container Toolkit installieren
ansible.builtin.apt:
name:
- nvidia-container-toolkit
state: present
- name: Docker daemon.json konfigurieren (NVIDIA als default runtime)
ansible.builtin.copy:
content: "{{ docker_daemon_config | to_nice_json }}"
dest: /etc/docker/daemon.json
mode: "0644"
notify: Docker neustarten
- name: nvidia-ctk runtime fuer Docker konfigurieren
ansible.builtin.command: nvidia-ctk runtime configure --runtime=docker
changed_when: false
- name: Reboot nach Treiberinstallation
ansible.builtin.reboot:
msg: "Reboot nach NVIDIA Treiber-Installation"
reboot_timeout: 300
when: nvidia_driver.changed