nvidia.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Add libnvidia container Repo
  16. yum_repository:
  17. name: libnvidia-container
  18. description: libnvidia-container
  19. baseurl: https://nvidia.github.io/libnvidia-container/stable/centos7/$basearch
  20. repo_gpgcheck: no
  21. gpgcheck: no
  22. gpgkey: https://nvidia.github.io/libnvidia-container/gpgkey
  23. sslverify: yes
  24. sslcacert: /etc/pki/tls/certs/ca-bundle.crt
  25. enabled: yes
  26. tags: install
  27. - name: Add nvidia-container-runtime Repo
  28. yum_repository:
  29. name: nvidia-container-runtime
  30. description: nvidia-container-runtime
  31. baseurl: https://nvidia.github.io/nvidia-container-runtime/stable/centos7/$basearch
  32. repo_gpgcheck: no
  33. gpgcheck: no
  34. gpgkey: https://nvidia.github.io/nvidia-container-runtime/gpgkey
  35. sslverify: yes
  36. sslcacert: /etc/pki/tls/certs/ca-bundle.crt
  37. enabled: yes
  38. tags: install
  39. - name: Add nvidia-docker Repo
  40. yum_repository:
  41. name: nvidia-docker
  42. description: nvidia-docker
  43. baseurl: https://nvidia.github.io/nvidia-docker/centos7/$basearch
  44. repo_gpgcheck: no
  45. gpgcheck: no
  46. gpgkey: https://nvidia.github.io/nvidia-docker/gpgkey
  47. enabled: yes
  48. sslverify: yes
  49. sslcacert: /etc/pki/tls/certs/ca-bundle.crt
  50. tags: install
  51. - name: Install nvidia driver and nvidia-docker2
  52. package:
  53. name: "{{ nvidia_packages }}"
  54. enablerepo: libnvidia-container,nvidia-docker
  55. state: present
  56. tags: install
  57. - name: Reboot after installing GPU drivers
  58. reboot:
  59. tags: install
  60. - name: Set nvidia as default runtime
  61. copy:
  62. src: daemon.json
  63. dest: "{{ daemon_file_dest }}"
  64. owner: root
  65. group: root
  66. mode: "{{ daemon_file_mode }}"
  67. tags: install
  68. - name: Restart and enable docker service
  69. service:
  70. name: docker
  71. state: restarted
  72. enabled: yes
  73. daemon_reload: yes
  74. tags: install