initial pfannkuchen
This commit is contained in:
parent
b6dafc7a73
commit
4d305fa19f
99 changed files with 3575 additions and 321 deletions
8
roles/nvidia/defaults/main.yml
Normal file
8
roles/nvidia/defaults/main.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
cuda_keyring_deb_url: "https://developer.download.nvidia.com/compute/cuda/repos/debian13/x86_64/cuda-keyring_1.1-1_all.deb"
|
||||
docker_daemon_config:
|
||||
default-runtime: nvidia
|
||||
runtimes:
|
||||
nvidia:
|
||||
path: nvidia-container-runtime
|
||||
runtimeArgs: []
|
||||
5
roles/nvidia/handlers/main.yml
Normal file
5
roles/nvidia/handlers/main.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Docker neustarten
|
||||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: restarted
|
||||
77
roles/nvidia/tasks/main.yml
Normal file
77
roles/nvidia/tasks/main.yml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
- 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 }}
|
||||
- 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue