--- - 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