-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.yml
74 lines (63 loc) · 2.58 KB
/
site.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
# Apply common configuration to all hosts
- hosts: all
gather_facts: true
- variables:
nvidia_driver_branch: "550"
nvidia_driver_ubuntu_packages_suffix: "-server"
nvidia_driver_ubuntu_packages_suffix: "-server"
# Installing with Canonical repositories
nvidia_driver_ubuntu_packages:
- "nvidia-headless-{{ nvidia_driver_ubuntu_branch }}{{ nvidia_driver_ubuntu_packages_suffix }}"
- "nvidia-utils-{{ nvidia_driver_ubuntu_branch }}{{ nvidia_driver_ubuntu_packages_suffix }}"
- "nvidia-headless-no-dkms-{{ nvidia_driver_ubuntu_branch }}{{ nvidia_driver_ubuntu_packages_suffix }}"
- "nvidia-kernel-source-{{ nvidia_driver_ubuntu_branch }}{{ nvidia_driver_ubuntu_packages_suffix }}"
# Installing with CUDA repositories
old_nvidia_driver_ubuntu_cuda_repo_gpgkey_id: "7fa2af80"
nvidia_driver_ubuntu_cuda_repo_baseurl: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}"
nvidia_driver_ubuntu_cuda_keyring_package: "cuda-keyring_1.0-1_all.deb"
nvidia_driver_ubuntu_cuda_keyring_url: "{{ nvidia_driver_ubuntu_cuda_repo_baseurl }}/{{ nvidia_driver_ubuntu_cuda_keyring_package }}"
nvidia_driver_ubuntu_cuda_package: "cuda-drivers-{{ nvidia_driver_ubuntu_branch }}"
tasks:
- name: disable cdrom apt repository
lineinfile:
path: /etc/apt/sources.list
state: absent
regexp: '^deb cdrom'
---
- name: remove ppa
apt_repository:
repo: ppa:graphics-drivers/ppa
state: absent
- name: remove old signing key
apt_key:
id: "{{ old_nvidia_driver_ubuntu_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_ubuntu_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 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 {}}}"