Initial support for Debian
This commit is contained in:
parent
8946eefeb5
commit
f543f72c00
@ -19,6 +19,33 @@ nvidia_driver_rhel_cuda_repo_gpgkey: "https://developer.download.nvidia.com/comp
|
||||
nvidia_driver_rhel_branch: "{{ nvidia_driver_branch }}"
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Debian
|
||||
##############################################################################
|
||||
|
||||
# Driver branch to install with Debian
|
||||
nvidia_driver_debian_branch: "{{ nvidia_driver_branch }}"
|
||||
|
||||
# Determine if we should install from CUDA repo instead of Canonical repos
|
||||
nvidia_driver_debian_install_from_cuda_repo: no
|
||||
|
||||
# Installing with Debian repositories
|
||||
nvidia_driver_debian_packages:
|
||||
- "nvidia-driver"
|
||||
- "nvidia-cuda-dev"
|
||||
- "nvidia-cudaaaa-toolkit"
|
||||
|
||||
nvidia_driver_debian_install_tesla_driver: no
|
||||
nvidia_driver_debian_tesla_package: "nvidia-tesla-470-driver"
|
||||
|
||||
# Installing with CUDA repositories
|
||||
old_nvidia_driver_debian_cuda_repo_gpgkey_id: "7fa2af80"
|
||||
nvidia_driver_debian_cuda_repo_baseurl: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _debian_repo_dir }}"
|
||||
nvidia_driver_debian_cuda_keyring_package: "cuda-keyring_1.1-1_all.deb"
|
||||
nvidia_driver_debian_cuda_keyring_url: "{{ nvidia_driver_debian_cuda_repo_baseurl }}/{{ nvidia_driver_debian_cuda_keyring_package }}"
|
||||
nvidia_driver_debian_cuda_package: "cuda-drivers-{{ nvidia_driver_debian_branch }}"
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Ubuntu #
|
||||
##############################################################################
|
||||
|
50
tasks/install-debian-cuda-repo.yml
Normal file
50
tasks/install-debian-cuda-repo.yml
Normal file
@ -0,0 +1,50 @@
|
||||
- name: add contrib & non-free repository
|
||||
replace:
|
||||
dest: /etc/apt/sources.list
|
||||
regexp: '^(deb(?!.* contrib).*)'
|
||||
replace: '\1 contrib non-free'
|
||||
|
||||
- name: remove old signing key
|
||||
apt_key:
|
||||
id: "{{ old_nvidia_driver_debian_cuda_repo_gpgkey_id }}"
|
||||
state: absent
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
when: nvidia_driver_add_repos | bool
|
||||
|
||||
- name: add CUDA keyring
|
||||
apt:
|
||||
deb: "{{ nvidia_driver_debian_cuda_keyring_url }}"
|
||||
state: "present"
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
when: nvidia_driver_add_repos | bool
|
||||
|
||||
- name: force an apt update
|
||||
apt:
|
||||
update_cache: true
|
||||
changed_when: false
|
||||
|
||||
- name: ensure kmod is installed
|
||||
apt:
|
||||
name: "kmod"
|
||||
state: "present"
|
||||
|
||||
- name: blacklist nouveau
|
||||
kernel_blacklist:
|
||||
name: nouveau
|
||||
state: present
|
||||
|
||||
- name: install Linux headers and non-free firmware
|
||||
apt:
|
||||
name:
|
||||
- linux-headers-{{ ansible_kernel }}
|
||||
- firmware-misc-nonfree
|
||||
state: present
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary(nvidia_driver_debian_cuda_package+'='+nvidia_driver_package_version, nvidia_driver_debian_cuda_package) }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
purge: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
35
tasks/install-debian.yml
Normal file
35
tasks/install-debian.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: add contrib & non-free repository
|
||||
replace:
|
||||
dest: /etc/apt/sources.list
|
||||
regexp: '^(deb(?!.* contrib).*)'
|
||||
replace: '\1 contrib non-free'
|
||||
|
||||
- name: update apt
|
||||
become: yes
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: install Linux headers and non-free firmware
|
||||
apt:
|
||||
name:
|
||||
- linux-headers-{{ ansible_kernel }}
|
||||
- firmware-misc-nonfree
|
||||
state: present
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary(item+'='+nvidia_driver_package_version, item) }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
purge: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
loop: "{{ nvidia_driver_debian_packages }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install tesla drivers
|
||||
apt:
|
||||
state: present
|
||||
name: "{{ nvidia_driver_debian_tesla_package }}"
|
||||
register: install_driver
|
||||
when: nvidia_driver_debian_install_tesla_driver == true
|
@ -5,6 +5,14 @@
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
|
||||
- name: debian install tasks (debian repos)
|
||||
include_tasks: install-debian.yml
|
||||
when: ansible_distribution == "Debian" and (not nvidia_driver_debian_install_from_cuda_repo)
|
||||
|
||||
- name: debian install tasks (CUDA repos)
|
||||
include_tasks: install-debian.yml
|
||||
when: ansible_distribution == "Debian" and nvidia_driver_debian_install_from_cuda_repo
|
||||
|
||||
- name: ubuntu install tasks (canonical repos)
|
||||
include_tasks: install-ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu' and (not nvidia_driver_ubuntu_install_from_cuda_repo)
|
||||
|
@ -1,2 +1,3 @@
|
||||
_debian_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.', '') }}/{{ ansible_architecture }}"
|
||||
_ubuntu_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.', '') }}/{{ ansible_architecture }}"
|
||||
_rhel_repo_dir: "rhel{{ ansible_distribution_major_version }}/{{ ansible_architecture }}"
|
||||
|
Loading…
Reference in New Issue
Block a user