Compare commits
	
		
			12 Commits
		
	
	
		
			66337f8771
			...
			4b9534a27e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4b9534a27e | |||
| f543f72c00 | |||
| 
						 | 
					8946eefeb5 | ||
| 
						 | 
					7b9fb62784 | ||
| 
						 | 
					35a769dd63 | ||
| 
						 | 
					d0023b68e0 | ||
| 
						 | 
					d0cf4a1e91 | ||
| 
						 | 
					8fa78e47b2 | ||
| 
						 | 
					9ca74a70b2 | ||
| 
						 | 
					320a28b0e4 | ||
| 
						 | 
					151facf7e2 | ||
| 
						 | 
					835eaf4602 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,2 @@
 | 
			
		||||
*.retry
 | 
			
		||||
.idea/
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.md
									
									
									
									
									
								
							@ -24,20 +24,20 @@ $ ansible-galaxy install nvidia.nvidia_driver
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| Variable                            | Default value                   | Description                                                                                                           |
 | 
			
		||||
| -------- | ------------- | ----------- |
 | 
			
		||||
|-------------------------------------|---------------------------------|-----------------------------------------------------------------------------------------------------------------------|
 | 
			
		||||
| `nvidia_driver_package_state`       | `"present"`                     | Package state for NVIDIA driver packages                                                                              |
 | 
			
		||||
| `nvidia_driver_package_version`     | `""`                            | Package version to install. Note that this should match the actual version of the deb or RPM package to be installed. |
 | 
			
		||||
| `nvidia_driver_persistence_mode_on` | `yes`                           | Whether to enable persistence mode (boolean)                                                                          |
 | 
			
		||||
| `nvidia_driver_skip_reboot`         | `no`                            | Whether to skip rebooting the node during the install                                                                 |
 | 
			
		||||
| `nvidia_driver_module_file`         | `"/etc/modprobe.d/nvidia.conf"` | Filename to use for NVIDIA driver parameters                                                                          |
 | 
			
		||||
| `nvidia_driver_module_params`       | `""`                            | Parameters to pass to the NVIDIA driver                                                                               |
 | 
			
		||||
| `nvidia_driver_branch` | `"510"` | Default driver branch to install |
 | 
			
		||||
| `nvidia_driver_branch`              | `"515"`                         | Default driver branch to install                                                                                      |
 | 
			
		||||
 | 
			
		||||
### Red Hat specific variables
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| Variable                               | Default value                                                                                                     | Description                       |
 | 
			
		||||
| -------- | ------------- | ----------- |
 | 
			
		||||
|----------------------------------------|-------------------------------------------------------------------------------------------------------------------|-----------------------------------|
 | 
			
		||||
| `epel_package`                         | `"https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"` | Package to install to enable EPEL |
 | 
			
		||||
| `nvidia_driver_rhel_cuda_repo_baseurl` | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/"`                                | Base URL to use for CUDA repo     |
 | 
			
		||||
| `nvidia_driver_rhel_cuda_repo_gpgkey`  | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/7fa2af80.pub"`                    | GPG key for the CUDA repo         |
 | 
			
		||||
@ -49,12 +49,11 @@ For Ubuntu installs, you have the choice of installing from the Canonical reposi
 | 
			
		||||
By default, the Canonical repositories will be used, and the driver installed will be the headless server driver.
 | 
			
		||||
 | 
			
		||||
| Variable                                      | Default value                                                                      | Description                                          |
 | 
			
		||||
| -------- | ------------- | ----------- |
 | 
			
		||||
|-----------------------------------------------|------------------------------------------------------------------------------------|------------------------------------------------------|
 | 
			
		||||
| `nvidia_driver_ubuntu_install_from_cuda_repo` | `no`                                                                               | Flag whether to use the CUDA repo                    |
 | 
			
		||||
| `nvidia_driver_ubuntu_cuda_repo_baseurl`      | `"http://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}"` | Base URL to use for CUDA repo                        |
 | 
			
		||||
| `nvidia_driver_ubuntu_cuda_repo_gpgkey_url` | `"https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub"` | GPG key for the CUDA repo |
 | 
			
		||||
| `nvidia_driver_ubuntu_cuda_repo_gpgkey_id` | `"7fa2af80"` | GPG key ID for the CUDA repo |
 | 
			
		||||
| `nvidia_driver_ubuntu_cuda_package`           | `"cuda-drivers"`                                                                   | Package name to install from CUDA repo               |
 | 
			
		||||
| `nvidia_driver_ubuntu_packages_suffix`        | `"-server"`                                                                        | The suffix added to the apt packages when installing |
 | 
			
		||||
 | 
			
		||||
## Example playbook
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ nvidia_driver_skip_reboot: no
 | 
			
		||||
nvidia_driver_module_file: /etc/modprobe.d/nvidia.conf
 | 
			
		||||
nvidia_driver_module_params: ''
 | 
			
		||||
nvidia_driver_add_repos: yes
 | 
			
		||||
nvidia_driver_branch: "510"
 | 
			
		||||
nvidia_driver_branch: "515"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##############################################################################
 | 
			
		||||
@ -14,11 +14,38 @@ nvidia_driver_branch: "510"
 | 
			
		||||
epel_package: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
 | 
			
		||||
epel_repo_key: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
 | 
			
		||||
nvidia_driver_rhel_cuda_repo_baseurl: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/"
 | 
			
		||||
nvidia_driver_rhel_cuda_repo_gpgkey: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/7fa2af80.pub"
 | 
			
		||||
nvidia_driver_rhel_cuda_repo_gpgkey: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _rhel_repo_dir }}/D42D0685.pub"
 | 
			
		||||
 | 
			
		||||
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-cuda-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                                                                     #
 | 
			
		||||
##############################################################################
 | 
			
		||||
@ -29,15 +56,18 @@ nvidia_driver_ubuntu_branch: "{{ nvidia_driver_branch }}"
 | 
			
		||||
# Determine if we should install from CUDA repo instead of Canonical repos
 | 
			
		||||
nvidia_driver_ubuntu_install_from_cuda_repo: no
 | 
			
		||||
 | 
			
		||||
nvidia_driver_ubuntu_packages_suffix: "-server"
 | 
			
		||||
 | 
			
		||||
# Installing with Canonical repositories
 | 
			
		||||
nvidia_driver_ubuntu_packages:
 | 
			
		||||
- "nvidia-headless-{{ nvidia_driver_ubuntu_branch }}-server"
 | 
			
		||||
- "nvidia-utils-{{ nvidia_driver_ubuntu_branch }}-server"
 | 
			
		||||
- "nvidia-headless-no-dkms-{{ nvidia_driver_ubuntu_branch }}-server"
 | 
			
		||||
- "nvidia-kernel-source-{{ nvidia_driver_ubuntu_branch }}-server"
 | 
			
		||||
- "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
 | 
			
		||||
nvidia_driver_ubuntu_cuda_repo_gpgkey_url: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub"
 | 
			
		||||
nvidia_driver_ubuntu_cuda_repo_gpgkey_id: "7fa2af80"
 | 
			
		||||
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 }}"
 | 
			
		||||
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
Package: *
 | 
			
		||||
Pin: release l=NVIDIA CUDA
 | 
			
		||||
Pin-Priority: 600
 | 
			
		||||
@ -27,7 +27,7 @@ platforms:
 | 
			
		||||
    - cuda_repo
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: ubuntu-2004-canonical
 | 
			
		||||
  - name: ubuntu-2004-canonical-server
 | 
			
		||||
    image: geerlingguy/docker-ubuntu2004-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
@ -38,6 +38,18 @@ platforms:
 | 
			
		||||
    - canonical_repo
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: ubuntu-2004-canonical-noserver
 | 
			
		||||
    image: geerlingguy/docker-ubuntu2004-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
    command: /sbin/init
 | 
			
		||||
    pre_build_image: true
 | 
			
		||||
    privileged: true
 | 
			
		||||
    groups:
 | 
			
		||||
    - canonical_repo
 | 
			
		||||
    - canonical_repo_noserver
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: ubuntu-2004-cuda
 | 
			
		||||
    image: geerlingguy/docker-ubuntu2004-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
@ -49,6 +61,28 @@ platforms:
 | 
			
		||||
    - cuda_repo
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: ubuntu-2204-canonical
 | 
			
		||||
    image: geerlingguy/docker-ubuntu2204-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
    command: /sbin/init
 | 
			
		||||
    pre_build_image: true
 | 
			
		||||
    privileged: true
 | 
			
		||||
    groups:
 | 
			
		||||
    - canonical_repo
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: ubuntu-2204-cuda
 | 
			
		||||
    image: geerlingguy/docker-ubuntu2204-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
    command: /sbin/init
 | 
			
		||||
    pre_build_image: true
 | 
			
		||||
    privileged: true
 | 
			
		||||
    groups:
 | 
			
		||||
    - cuda_repo
 | 
			
		||||
    - ubuntu
 | 
			
		||||
 | 
			
		||||
  - name: centos-7
 | 
			
		||||
    image: geerlingguy/docker-centos7-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
@ -57,13 +91,13 @@ platforms:
 | 
			
		||||
    pre_build_image: true
 | 
			
		||||
    privileged: true
 | 
			
		||||
 | 
			
		||||
  - name: centos-8
 | 
			
		||||
    image: geerlingguy/docker-centos8-ansible
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
    command: /sbin/init
 | 
			
		||||
    pre_build_image: true
 | 
			
		||||
    privileged: true
 | 
			
		||||
#  - name: centos-8
 | 
			
		||||
#    image: geerlingguy/docker-centos8-ansible
 | 
			
		||||
#    volumes:
 | 
			
		||||
#      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
			
		||||
#    command: /sbin/init
 | 
			
		||||
#    pre_build_image: true
 | 
			
		||||
#    privileged: true
 | 
			
		||||
 | 
			
		||||
provisioner:
 | 
			
		||||
  name: ansible
 | 
			
		||||
@ -75,6 +109,8 @@ provisioner:
 | 
			
		||||
        nvidia_driver_skip_reboot: true
 | 
			
		||||
      canonical_repo:
 | 
			
		||||
        nvidia_driver_ubuntu_install_from_cuda_repo: false
 | 
			
		||||
      canonical_repo_noserver:
 | 
			
		||||
        nvidia_driver_ubuntu_packages_suffix: ""
 | 
			
		||||
      cuda_repo:
 | 
			
		||||
        nvidia_driver_ubuntu_install_from_cuda_repo: true
 | 
			
		||||
verifier:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
@ -4,34 +4,35 @@
 | 
			
		||||
    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"
 | 
			
		||||
  when: nvidia_driver_add_repos | bool
 | 
			
		||||
 | 
			
		||||
- name: add key
 | 
			
		||||
- name: remove old signing key
 | 
			
		||||
  apt_key:
 | 
			
		||||
    url: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_url }}"
 | 
			
		||||
    id: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_id }}"
 | 
			
		||||
    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: add repo
 | 
			
		||||
  apt_repository:
 | 
			
		||||
    repo: "deb {{ nvidia_driver_ubuntu_cuda_repo_baseurl }} /"
 | 
			
		||||
    update_cache: yes
 | 
			
		||||
  environment: "{{proxy_env if proxy_env is defined else {}}}"
 | 
			
		||||
  when: nvidia_driver_add_repos | bool
 | 
			
		||||
 | 
			
		||||
- 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) }}"
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,6 @@
 | 
			
		||||
    state: "{{ nvidia_driver_package_state }}"
 | 
			
		||||
    autoremove: "{{ nvidia_driver_package_state == 'absent' }}"
 | 
			
		||||
    purge: "{{ nvidia_driver_package_state == 'absent' }}"
 | 
			
		||||
  with_items: "{{ nvidia_driver_ubuntu_packages }}"
 | 
			
		||||
  loop: "{{ nvidia_driver_ubuntu_packages }}"
 | 
			
		||||
  register: install_driver
 | 
			
		||||
  environment: "{{proxy_env if proxy_env is defined else {}}}"
 | 
			
		||||
 | 
			
		||||
@ -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