feat(ansible): install amdgpu drivers and packages on sles

This commit is contained in:
Michele Cereda
2024-12-20 18:19:28 +01:00
parent 3fb382ede6
commit 6194390981
3 changed files with 68 additions and 1 deletions

View File

@@ -75,6 +75,7 @@
"airgap", "airgap",
"airgapped", "airgapped",
"alertmanager", "alertmanager",
"amdgpu",
"apiserver", "apiserver",
"asciicast", "asciicast",
"asciinema", "asciinema",
@@ -294,6 +295,7 @@
"ripsecrets", "ripsecrets",
"rmmod", "rmmod",
"roboto", "roboto",
"rocm",
"roff", "roff",
"rootlv", "rootlv",
"rootvg", "rootvg",
@@ -312,6 +314,7 @@
"setfattr", "setfattr",
"sidekiq", "sidekiq",
"siem", "siem",
"sles",
"slurm", "slurm",
"snmp", "snmp",
"spiffe", "spiffe",
@@ -373,6 +376,7 @@
"yellowdog", "yellowdog",
"ykman", "ykman",
"yubikey", "yubikey",
"zstd" "zstd",
"zypp"
] ]
} }

View File

@@ -0,0 +1,49 @@
---
- name: Install AMDGPU drivers and applications
hosts: all
vars:
drivers_version: 6.3
distribution_version: "{{ ansible_distribution_version }}"
architecture: "{{ ansible_architecture }}"
tasks:
- name: Install AMDGPU drivers and applications on SLES
# refer https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/native-install/sles.html
tags: sles
when:
- ansible_pkg_mgr | lower in ['zypper']
- ansible_distribution_file_variety | lower in ['suse']
block:
- name: Add the AMDGPU kernel-mode driver repository on SLES
tags: repository
become: true
ansible.builtin.copy:
dest: /etc/zypp/repos.d/amdgpu.repo
content: |
[amdgpu]
name=amdgpu
baseurl=https://repo.radeon.com/amdgpu/{{ drivers_version }}/sle/{{ distribution_version }}/main/{{ architecture }}/
enabled=1
gpgcheck=1
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
- name: Add the AMDGPU ROCm packages repository on SLES
tags: repository
become: true
ansible.builtin.copy:
dest: /etc/zypp/repos.d/rocm.repo
content: |
[ROCm-{{ drivers_version }}]
name=ROCm{{ drivers_version }}
baseurl=https://repo.radeon.com/rocm/zyp/{{ drivers_version }}/main
enabled=1
gpgcheck=1
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key
- name: Install AMDGPU packages on SLES
tags: package
become: true
community.general.zypper:
name:
- amdgpu-dkms
- rocm
disable_recommends: false
update_cache: true

View File

@@ -28,6 +28,7 @@
1. [Ansible Vault](#ansible-vault) 1. [Ansible Vault](#ansible-vault)
1. [Best practices](#best-practices) 1. [Best practices](#best-practices)
1. [Troubleshooting](#troubleshooting) 1. [Troubleshooting](#troubleshooting)
1. [ERROR: Ansible could not initialize the preferred locale: unsupported locale setting](#error-ansible-could-not-initialize-the-preferred-locale-unsupported-locale-setting)
1. [Print all known variables](#print-all-known-variables) 1. [Print all known variables](#print-all-known-variables)
1. [Force notified handlers to run at a specific point](#force-notified-handlers-to-run-at-a-specific-point) 1. [Force notified handlers to run at a specific point](#force-notified-handlers-to-run-at-a-specific-point)
1. [Time tasks execution](#time-tasks-execution) 1. [Time tasks execution](#time-tasks-execution)
@@ -1139,6 +1140,17 @@ Or even edit their content with `ansible-vault edit 'path/to/file'`.
## Troubleshooting ## Troubleshooting
### ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
`ansible-core` requires the locale to have `UTF-8` encoding [since 2.14.0][ansible v2.14 CHANGELOG]:
> ansible - At startup the filesystem encoding and locale are checked to verify they are UTF-8. If not, the process
> exits with an error reporting the errant encoding.
```sh
LANG='C.UTF-8' ansible …
```
### Print all known variables ### Print all known variables
Print the special variable `vars` as a task: Print the special variable `vars` as a task:
@@ -1494,6 +1506,7 @@ Solution: use a version of `ansible-core` lower than 2.17.
- [Patterns: targeting hosts and groups] - [Patterns: targeting hosts and groups]
- [How to use ansible with S3 - Ansible aws_s3 examples] - [How to use ansible with S3 - Ansible aws_s3 examples]
- [How to run Ansible with_fileglob in alphabetical order?] - [How to run Ansible with_fileglob in alphabetical order?]
- [Ansible v2.14 CHANGELOG]
<!-- <!--
Reference Reference
@@ -1517,6 +1530,7 @@ Solution: use a version of `ansible-core` lower than 2.17.
[ansible galaxy user guide]: https://docs.ansible.com/ansible/latest/galaxy/user_guide.html [ansible galaxy user guide]: https://docs.ansible.com/ansible/latest/galaxy/user_guide.html
[ansible navigator]: https://ansible.readthedocs.io/projects/navigator/en/stable/ [ansible navigator]: https://ansible.readthedocs.io/projects/navigator/en/stable/
[ansible runner]: https://ansible.readthedocs.io/projects/runner/en/stable/ [ansible runner]: https://ansible.readthedocs.io/projects/runner/en/stable/
[ansible v2.14 changelog]: https://github.com/ansible/ansible/blob/7bb078bd740fba8ad43cc69e18fc8aeb4719180a/changelogs/CHANGELOG-v2.14.rst#id11
[asynchronous actions and polling]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_async.html [asynchronous actions and polling]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_async.html
[automating helm using ansible]: https://www.ansible.com/blog/automating-helm-using-ansible [automating helm using ansible]: https://www.ansible.com/blog/automating-helm-using-ansible
[blocks]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_blocks.html [blocks]: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_blocks.html