File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 29
29
when : " 'No matching Modules to list' in _cuda_driver_module_enabled.stderr"
30
30
changed_when : " 'Nothing to do' not in _cuda_driver_module_enable.stdout"
31
31
32
- - name : Check if nvidia driver module is installed
33
- ansible.builtin.command : dnf module list --installed nvidia-driver
32
+ - name : Read module info for list of packages
33
+ ansible.builtin.shell :
34
+ cmd : >-
35
+ dnf module info nvidia-driver:{{ cuda_nvidia_driver_stream }} |
36
+ grep {{ cuda_nvidia_driver_version }}.el{{ ansible_distribution_major_version }}.{{ ansible_architecture }}
34
37
changed_when : false
35
- failed_when : false
36
- register : _cuda_driver_module_installed
38
+ register : _cuda_driver_module_packages
39
+ # returns a list of lines like ' : libnvidia-cfg-3:570.133.20-1.el9.x86_64'
37
40
38
- - name : Install nvidia drivers
39
- ansible.builtin.command : " dnf module install -y nvidia-driver-{{ cuda_nvidia_driver_version}}"
41
+ - name : Install nvidia driver packages
42
+ ansible.builtin.dnf :
43
+ name : " {{ _cuda_driver_module_packages.stdout_lines | map('trim', ': ') }}"
40
44
register : _cuda_driver_install
41
- when : " 'No matching Modules to list' in _cuda_driver_module_installed.stderr "
42
- changed_when : " 'Nothing to do' not in _cuda_driver_install.stdout "
45
+
46
+ - meta : end_here
43
47
44
48
- name : Check kernel has not been modified
45
49
assert :
You can’t perform that action at this time.
0 commit comments