Code/gpu

gpu

Ansible role that installs nvidia gpu drivers and container runtime.

yannick

README

GPU Role

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.

Features

  • NVIDIA driver installation (nvidia-driver-535 or specified version)
  • NVIDIA Container Runtime for Docker GPU support
  • Clean and simple - no unnecessary complexity

Requirements

  • Ubuntu 20.04/22.04/24.04
  • NVIDIA GPU hardware
  • Internet connection
  • Depends on geerlingguy.docker role

Quick Start

- hosts: gpu_servers
  become: yes
  roles:
    - role: geerlingguy.docker
    - role: gpu

Variables

Simple Configuration

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

What This Role Does

  1. Installs NVIDIA drivers using Ubuntu's built-in packages (nvidia-driver-535 by default)
  2. Installs NVIDIA Container Runtime for Docker GPU support
  3. Configures Docker to use the NVIDIA runtime
  4. That's it! No complex detection, no monitoring, no debugging tools

Testing GPU Support

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

Troubleshooting

Driver not working?

  • Reboot after installation
  • Check nvidia-smi command exists
  • Verify in Docker: docker run --rm --gpus all nvidia/cuda:12.0-base-ubuntu22.04 nvidia-smi

Docker GPU not working?

  • Restart Docker: sudo systemctl restart docker
  • Check daemon config: /etc/docker/daemon.json

Examples

Basic Setup

- hosts: gpu_compute
  become: yes
  roles:
    - role: geerlingguy.docker
    - role: gpu

Specific Driver Version

- hosts: gpu_compute
  become: yes
  roles:
    - role: geerlingguy.docker
    - role: gpu
      vars:
        gpu_driver_version: "525"

License

MIT

Quick Actions

Browse FilesView Commits
git clone https://rakys.xyz/git/gpu.git

Repository Statistics

0
Stars
0
Forks
1
Watchers
0
Issues
Default Branch:main
Created:September 3, 2025
Last Updated:October 2, 2025
Repository Size:0.03 KB