commit 82b93ed87230f5a68087dadb0de0c3e8b3ba1c21 Author: Alwin Berger Date: Wed Jul 10 13:21:57 2024 +0200 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..5ebb61c --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# NVIDIA + Podman +This role installs the NVIDIA drivers (from non-free), container toolkit (NVIDIAs repo) and podman on a debian (bookworm) system. +# License +``` +Zero-Clause BSD +============= + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +``` +# Author Information +Alwin Berger, Informatik 12, TU Dortmund, alwin.berger@udo.edu diff --git a/handlers/main.yaml b/handlers/main.yaml new file mode 100644 index 0000000..9d53eae --- /dev/null +++ b/handlers/main.yaml @@ -0,0 +1,6 @@ +--- +- name: 'apt update' + ansible.builtin.apt: + update_cache: yes + environment: + NEEDRESTART_SUSPEND: 'please no reboot now' diff --git a/tasks/main.yaml b/tasks/main.yaml new file mode 100644 index 0000000..41c1c5b --- /dev/null +++ b/tasks/main.yaml @@ -0,0 +1,50 @@ +--- +- 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' ]