52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
---
|
|
# https://wiki.debian.org/NvidiaGraphicsDrivers
|
|
- name: Add 'contrib' and 'non-free' repository in /etc/apt/sources.list
|
|
lineinfile:
|
|
path: /etc/apt/sources.list
|
|
regexp: '^deb\s+(.*)/debian/\s+bookworm\s+(.*)firmware$'
|
|
line: 'deb \1/debian/ bookworm \2firmware contrib non-free'
|
|
backrefs: yes
|
|
state: present
|
|
notify:
|
|
- apt update
|
|
|
|
- name: Install nvidia drivers
|
|
apt:
|
|
name: [ 'linux-headers-amd64', 'nvidia-driver', 'firmware-misc-nonfree' ]
|
|
|
|
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
- name: Install nvidia-container-toolkit
|
|
block:
|
|
- name: libnvidia-container | no apt key
|
|
ansible.builtin.get_url:
|
|
url: https://nvidia.github.io/libnvidia-container/gpgkey
|
|
dest: /usr/share/keyrings/nvidia-container-toolkit-keyring.asc
|
|
checksum: sha256:c880576d6cf75a48e5027a871bac70fd0421ab07d2b55f30877b21f1c87959c9
|
|
|
|
- name: libnvidia-container | dearmor key
|
|
ansible.builtin.command: gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg /usr/share/keyrings/nvidia-container-toolkit-keyring.asc
|
|
args:
|
|
creates: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
|
|
|
|
- name: libnvidia-container | apt source
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /"
|
|
state: present
|
|
notify:
|
|
- apt update
|
|
|
|
- name: libnvidia-container | install nvidia-container-toolkit
|
|
apt:
|
|
name: ['nvidia-container-toolkit']
|
|
|
|
# https://docs.nvidia.com/ai-enterprise/deployment-guide-rhel-with-kvm/0.1.0/podman.html
|
|
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/cdi-support.html
|
|
- name: libnvidia-container | cdi
|
|
ansible.builtin.command: sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
|
|
args:
|
|
creates: /etc/cdi/nvidia.yaml
|
|
|
|
- name: Install podman
|
|
apt:
|
|
name: [ 'podman', 'podman-compose' ]
|