/
/
Ansible role that installs nvidia gpu drivers and container runtime.
Simple NVIDIA GPU support role for Ubuntu systems. Installs NVIDIA drivers and container runtime for Docker GPU support - no complex detection, no monitoring, just the basics.
geerlingguy.docker role- hosts: gpu_servers
become: yes
roles:
- role: geerlingguy.docker
- role: gpu
# Enable GPU role
gpu_enabled: true
# Driver version (535 is stable, or 'latest')
gpu_driver_version: "535"
# Enable container runtime for Docker
gpu_container_runtime_enabled: true
That's it - no complex configuration needed!
After installation, test with:
# Check driver installation
nvidia-smi
# Test Docker GPU access
docker run --rm --runtime=nvidia --gpus all nvidia/cuda:12.0-base-ubuntu22.04 nvidia-smi
Driver not working?
nvidia-smi command existsdocker run --rm --gpus all nvidia/cuda:12.0-base-ubuntu22.04 nvidia-smiDocker GPU not working?
sudo systemctl restart docker/etc/docker/daemon.json- hosts: gpu_compute
become: yes
roles:
- role: geerlingguy.docker
- role: gpu
- hosts: gpu_compute
become: yes
roles:
- role: geerlingguy.docker
- role: gpu
vars:
gpu_driver_version: "525"
MIT