amd.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 2022 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. - block:
  16. - name: Add AMD ROCm repository for CentOS 7.x
  17. yum_repository:
  18. name: ROCm
  19. description: AMD GPU ROCm Repository
  20. baseurl: https://repo.radeon.com/rocm/yum/rpm
  21. gpgcheck: yes
  22. gpgkey: https://repo.radeon.com/rocm/rocm.gpg.key
  23. enabled: yes
  24. tags: install
  25. when: ansible_facts['distribution_major_version'] == "7"
  26. - name: Add AMD ROCm repository for CentOS/RockyLinux 8.x
  27. yum_repository:
  28. name: ROCm
  29. description: AMD GPU ROCm Repository
  30. baseurl: https://repo.radeon.com/rocm/centos8/rpm
  31. gpgcheck: yes
  32. gpgkey: https://repo.radeon.com/rocm/rocm.gpg.key
  33. enabled: yes
  34. tags: install
  35. when: ansible_facts['distribution_major_version'] == "8"
  36. - name: Install AMD ROCm drivers
  37. package:
  38. name: rocm-dkms
  39. enablerepo: ROCm
  40. state: present
  41. tags: install
  42. - name: Reboot after installing GPU drivers
  43. reboot:
  44. tags: install
  45. when: ( os_supported_leap not in compute_os )
  46. - block:
  47. - name: Installing dkms
  48. package:
  49. name: dkms
  50. state: present
  51. changed_when: true
  52. tags: install
  53. - name: Add AMD ROCm repository for leap
  54. zypper_repository:
  55. name: rocm
  56. repo: "{{ amd_repo }}"
  57. state: present
  58. failed_when: false
  59. tags: install
  60. - name: Import gpg-key for installing AMD ROCm
  61. rpm_key:
  62. key: "{{ gpg_key_amd }}"
  63. state: present
  64. tags: install
  65. - name: Install AMD ROCm drivers
  66. ansible.builtin.expect:
  67. command: zypper install rocm-dkms
  68. responses:
  69. (.*) [1/2/c/d/?](.): '2'
  70. (.*)(y): 'y'
  71. tags: install
  72. - name: Allowing modules
  73. copy:
  74. src: module.conf
  75. dest: "{{ amd_gpu_dest }}"
  76. owner: root
  77. group: root
  78. mode: "{{ conf_file_mode }}"
  79. tags: install
  80. - name: Enable the modules amdgpu
  81. modprobe:
  82. name: amdgpu
  83. state: present
  84. tags: install
  85. - name: Reboot after installing GPU drivers
  86. reboot:
  87. tags: install
  88. when: ( os_supported_leap in compute_os ) and ( ansible_distribution_version >= os_supported_leap_version )