docker/nvidia

This commit is contained in:
Nicole O'Connor 2024-07-31 13:21:39 -07:00
parent 067233e636
commit e6cbaa5fc2
2 changed files with 59 additions and 0 deletions

42
deploy-docker.yaml Normal file
View File

@ -0,0 +1,42 @@
---
- name: "Setup Docker"
become: true
tasks:
- name: "Download Docker Repository Key"
# HACK: apt_key has been deprecated, and its current (2023) replacement appears to be nothing
#ansible.builtin.apt_key:
# url: https://download.docker.com/linux/ubuntu/gpg
# id: 7EA0A9C3F273FCD8
# state: present
ansible.builtin.get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /tmp/docker.gpg.armor
- name: "Add Docker Repository Key"
ansible.builtin.shell:
cmd: gpg --dearmor -o /etc/apt/keyrings/docker.gpg < /tmp/docker.gpg.armor
creates: /etc/apt/keyrings/docker.gpg
- name: "Add Docker Repository"
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
filename: docker
state: present
- name: "Install Docker packages"
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- docker-buildx-plugin
- docker-compose-plugin
- python3-docker
- unzip
- name: "Add self to docker group"
ansible.builtin.user:
name: "{{ ansible_user }}"
append: true
groups:
- docker
- name: "Start Docker"
ansible.builtin.service:
name: docker
state: started
enabled: true

17
deploy-nvidia.yaml Normal file
View File

@ -0,0 +1,17 @@
---
- name: Setup NVIDIA drivers
become: true
tasks:
- name: "Adding NVIDIA CUDA repository"
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
filename: nvidia-upstream-ppa
- name: "Installing CUDA"
ansible.builtin.apt:
pkg:
- cuda-12
- nvidia-headless
- name: "Making sure NVIDIA UVM is working"
community.general.modprobe:
name: "nvidia_uvm"
state: present