Ubuntu: Use NVIDIA server drivers from Canonical
- Add support for using the NVIDIA headless server packages from the upstream Canonical repos - Keep support for using the CUDA repository instead, but make non-default
This commit is contained in:
35
tasks/install-ubuntu-cuda-repo.yml
Normal file
35
tasks/install-ubuntu-cuda-repo.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: remove ppa
|
||||
apt_repository:
|
||||
repo: ppa:graphics-drivers/ppa
|
||||
state: absent
|
||||
|
||||
- name: add pin file
|
||||
copy:
|
||||
src: "cuda-ubuntu.pin"
|
||||
dest: "/etc/apt/preferences.d/cuda-repository-pin-600"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
||||
- name: add key
|
||||
apt_key:
|
||||
url: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_url }}"
|
||||
id: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_id }}"
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
|
||||
- name: add repo
|
||||
apt_repository:
|
||||
repo: "deb {{ nvidia_driver_ubuntu_cuda_repo_baseurl }} /"
|
||||
update_cache: yes
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary(nvidia_driver_ubuntu_cuda_package+'='+nvidia_driver_package_version, nvidia_driver_ubuntu_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 {}}}"
|
||||
@@ -4,32 +4,12 @@
|
||||
repo: ppa:graphics-drivers/ppa
|
||||
state: absent
|
||||
|
||||
- name: add pin file
|
||||
copy:
|
||||
src: "cuda-ubuntu.pin"
|
||||
dest: "/etc/apt/preferences.d/cuda-repository-pin-600"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
||||
- name: add key
|
||||
apt_key:
|
||||
url: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_url }}"
|
||||
id: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_id }}"
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
|
||||
- name: add repo
|
||||
apt_repository:
|
||||
repo: "deb {{ nvidia_driver_ubuntu_cuda_repo_baseurl }} /"
|
||||
update_cache: yes
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
- name: install driver packages
|
||||
apt:
|
||||
name: "{{ nvidia_driver_package_version | ternary('cuda-drivers='+nvidia_driver_package_version, 'cuda-drivers') }}"
|
||||
state: "{{ nvidia_driver_package_state }}"
|
||||
name: "{{ nvidia_driver_package_version | ternary(item+'='+nvidia_driver_package_version, item) }}"
|
||||
state: "{{ nvidia_driver_package_version }}"
|
||||
autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
purge: "{{ nvidia_driver_package_state == 'absent' }}"
|
||||
with_items: "{{ nvidia_driver_ubuntu_packages }}"
|
||||
register: install_driver
|
||||
environment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
envrionment: "{{proxy_env if proxy_env is defined else {}}}"
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
state: absent
|
||||
ignore_errors: true
|
||||
|
||||
- name: ubuntu install tasks
|
||||
- name: ubuntu install tasks (canonical repos)
|
||||
include_tasks: install-ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
when: ansible_distribution == 'Ubuntu' and (not nvidia_driver_ubuntu_install_from_cuda_repo)
|
||||
|
||||
- name: ubuntu install tasks (CUDA repo)
|
||||
include_tasks: install-ubuntu-cuda-repo.yml
|
||||
when: ansible_distribution == 'Ubuntu' and nvidia_driver_ubuntu_install_from_cuda_repo
|
||||
|
||||
- name: redhat family install tasks
|
||||
include_tasks: install-redhat.yml
|
||||
|
||||
Reference in New Issue
Block a user