Skip to content

Commit

Permalink
nvidia: use udev rule for the symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
saltydk committed Mar 2, 2024
1 parent fba24b2 commit 926f0bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 0 additions & 3 deletions roles/docker/templates/nvidia-persistenced.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ Wants=syslog.target

[Service]
Type=forking
{% if nvidia_docker_enable_nvidia_ctk %}
ExecStartPre=/usr/bin/nvidia-ctk system create-dev-char-symlinks --create-all
{% endif %}
ExecStart=/usr/bin/nvidia-persistenced
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced

Expand Down
2 changes: 0 additions & 2 deletions roles/nvidia/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ nvidia_docker_runtime_docker_daemon_json_jq_command: |
| .runtimes.nvidia.runtimeArgs = []' \
/etc/docker/daemon.json | jq --sort-keys | sponge /etc/docker/daemon.json
nvidia_docker_enable_nvidia_ctk: true

################################
# Kernel
################################
Expand Down
2 changes: 2 additions & 0 deletions roles/nvidia/files/99-nvidia-udev.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This will create /dev/char symlinks to all device nodes
ACTION=="add", DEVPATH=="/bus/pci/drivers/nvidia", RUN+="/usr/bin/nvidia-ctk system create-dev-char-symlinks --create-all"
13 changes: 13 additions & 0 deletions roles/nvidia/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@
ansible.builtin.include_tasks: "subtasks/patch.yml"
when: (not nvidia_patch_backup_folder.stat.exists)

# Install Nvidia udev rule

- name: Copy the NVIDIA udev rule file
ansible.builtin.copy:
src: 99-nvidia-udev.rules
dest: /etc/udev/rules.d/99-nvidia-udev.rules
owner: root
group: root
mode: '0644'

- name: Reload udev rules
ansible.builtin.shell: udevadm control --reload-rules && udevadm trigger

# Install Nvidia Runtime Container

- name: "Nvidia Docker Task"
Expand Down

0 comments on commit 926f0bd

Please sign in to comment.