This commit is contained in:
c4ch3c4d3
2026-04-01 17:09:27 -06:00
parent a2d4f9d86d
commit 30b919c0b9
7 changed files with 328 additions and 89 deletions
+114 -19
View File
@@ -1,7 +1,6 @@
- name: Install Debian/Ubuntu prerequisites
become: true
apt:
name:
- name: Define Debian/Ubuntu prerequisite packages
set_fact:
courseware_linux_prereq_packages:
- build-essential
- ca-certificates
- cmake
@@ -18,8 +17,47 @@
- python3-venv
- unzip
- zstd
state: present
update_cache: true
- name: Install Debian/Ubuntu prerequisites
block:
- name: Install Debian/Ubuntu prerequisite packages
become: true
apt:
name: "{{ courseware_linux_prereq_packages }}"
state: present
update_cache: true
rescue:
- name: Repair interrupted dpkg state before retrying prerequisites
become: true
command:
argv:
- dpkg
- --configure
- -a
register: courseware_dpkg_repair
changed_when: false
failed_when: false
- name: Repair broken apt dependencies before retrying prerequisites
become: true
command:
argv:
- apt-get
- -y
- --fix-broken
- install
environment:
DEBIAN_FRONTEND: noninteractive
register: courseware_apt_fix_broken
changed_when: >-
'0 upgraded, 0 newly installed, 0 to remove' not in courseware_apt_fix_broken.stdout
- name: Retry Debian/Ubuntu prerequisite package install
become: true
apt:
name: "{{ courseware_linux_prereq_packages }}"
state: present
update_cache: true
- name: Query CUDA toolkit apt candidate
command: apt-cache policy nvidia-cuda-toolkit
@@ -66,31 +104,88 @@
nvcc --version
ls /usr/local/cuda/include/cuda_runtime.h
when:
- not courseware_is_wsl
- courseware_host_profile == "native-debian-ubuntu"
- courseware_cuda_toolkit_package_available
- courseware_nvcc_check.rc != 0
- not courseware_cuda_toolkit_ready
- name: Fail with CUDA toolkit guidance when no apt candidate exists
- name: Fail when native CUDA network repository bootstrap is unsupported
fail:
msg: |
CUDA Toolkit is not available from this distro's current apt sources.
This native {{ ansible_distribution }} {{ ansible_distribution_version }} host does not match the CUDA network-repository variants this installer knows how to bootstrap automatically.
This installer needs the Linux-side CUDA toolkit for llama.cpp, not just a working `nvidia-smi`.
Supported native CUDA repo bootstrap targets currently match NVIDIA's documented Debian/Ubuntu paths:
- Debian 12 and Debian 13 on x86_64
- Ubuntu 22.04 and Ubuntu 24.04 on x86_64 or arm64
On WSL this usually means:
- Windows side: the NVIDIA driver is installed correctly
- Linux side: the CUDA toolkit repository is still missing
Add NVIDIA's CUDA repository for your Debian/Ubuntu release, install the toolkit, then rerun:
bash deploy-courseware.sh
Install the Linux-side CUDA toolkit manually for this host, then rerun:
./labctl up
Verify with:
nvcc --version
ls /usr/local/cuda/include/cuda_runtime.h
when:
- not courseware_is_wsl
- courseware_host_profile == "native-debian-ubuntu"
- not courseware_cuda_toolkit_package_available
- courseware_nvcc_check.rc != 0
- not courseware_cuda_toolkit_ready
- not courseware_native_cuda_repo_supported
- name: Bootstrap NVIDIA CUDA network repository for native Debian/Ubuntu
block:
- name: Download NVIDIA CUDA keyring package
get_url:
url: "{{ courseware_native_cuda_keyring_url }}"
dest: "{{ courseware_native_cuda_keyring_local_path }}"
mode: "0644"
force: false
- name: Install NVIDIA CUDA keyring package
become: true
apt:
deb: "{{ courseware_native_cuda_keyring_local_path }}"
state: present
- name: Install CUDA toolkit from NVIDIA network repository
become: true
apt:
name: "{{ courseware_native_cuda_toolkit_package }}"
state: present
update_cache: true
rescue:
- name: Repair interrupted dpkg state before retrying CUDA repository install
become: true
command:
argv:
- dpkg
- --configure
- -a
changed_when: false
failed_when: false
- name: Repair broken apt dependencies before retrying CUDA repository install
become: true
command:
argv:
- apt-get
- -y
- --fix-broken
- install
environment:
DEBIAN_FRONTEND: noninteractive
register: courseware_cuda_repo_fix_broken
changed_when: >-
'0 upgraded, 0 newly installed, 0 to remove' not in courseware_cuda_repo_fix_broken.stdout
- name: Retry CUDA toolkit install from NVIDIA network repository
become: true
apt:
name: "{{ courseware_native_cuda_toolkit_package }}"
state: present
update_cache: true
when:
- courseware_host_profile == "native-debian-ubuntu"
- not courseware_cuda_toolkit_package_available
- not courseware_cuda_toolkit_ready
- courseware_native_cuda_repo_supported
- name: Check for Ollama binary
command: which ollama