|
| 1 | +--- |
| 2 | +# This playbook performs the system upgrade from RockyLinux 9.6 to 9.7 on hosts |
| 3 | +# using doca ofed kernel modules and utilities. |
| 4 | +# It prevents the install of the dkms toolchain and dkms modules that would be |
| 5 | +# used instead or our precompiled modules if a direct `dnf upgrade` was run. |
| 6 | +# |
| 7 | +# It must be run after new package snapshots have been merged and |
| 8 | +# `pulp-repo-sync.yml` and `pulp-repo-publish.yml` have been run. |
| 9 | +# Also `kayobe overcloud host configure -t dnf` must have been run for the new |
| 10 | +# `doca.repo` to be present (the doca version is in the url) on the mlnx hosts. |
| 11 | + |
| 12 | +- name: Prepare upgrade from Rocky Linux 9.6 to 9.7 |
| 13 | + hosts: mlnx |
| 14 | + serial: "{{ lookup('env', 'ANSIBLE_SERIAL') | default(1, true) }}" |
| 15 | + gather_facts: true |
| 16 | + tags: pre |
| 17 | + vars: |
| 18 | + # we don't build kernel modules for each version, eg 5.14.0-611.13.1 has been built, |
| 19 | + # but not 5.14.0-611.20.1. |
| 20 | + doca_kernel_version: "{{ stackhpc_doca_kernel_version_matrix[stackhpc_pulp_repo_rocky_9_minor_version] }}" |
| 21 | + tasks: |
| 22 | + - name: Assert that hosts are running Rocky Linux 9.6 |
| 23 | + ansible.builtin.assert: |
| 24 | + that: |
| 25 | + - ansible_facts.distribution == 'Rocky' |
| 26 | + - ansible_facts.distribution_version == '9.6' |
| 27 | + - os_distribution == 'rocky' |
| 28 | + fail_msg: >- |
| 29 | + This playbook is only designed for Rocky Linux 9.6 hosts. Ensure |
| 30 | + that you are limiting it to only run on Rocky Linux 9.6 hosts and |
| 31 | + os_distribution is set to rocky. |
| 32 | +
|
| 33 | + - name: Ensure doca kernel repo is up to date |
| 34 | + ansible.builtin.dnf: |
| 35 | + name: doca-kernel-repo |
| 36 | + state: latest |
| 37 | + update_cache: true |
| 38 | + become: true |
| 39 | + |
| 40 | + # This is required by mlnx-ofa_kernel, and comes from the doca repository. |
| 41 | + # It is already present when doca-ofed is installed, but will be upgraded. |
| 42 | + - name: Ensure mlnx-tools is installed |
| 43 | + ansible.builtin.dnf: |
| 44 | + name: mlnx-tools |
| 45 | + state: latest |
| 46 | + update_cache: true |
| 47 | + become: true |
| 48 | + |
| 49 | + - name: Ensure appropriate doca-kernel is installed |
| 50 | + ansible.builtin.dnf: |
| 51 | + name: "doca-kernel-{{ doca_kernel_version }}" |
| 52 | + state: latest |
| 53 | + disablerepo: doca |
| 54 | + become: true |
| 55 | + |
| 56 | + # doca-ofed 3.2 starts to depend on the dkms modules. It was not the case |
| 57 | + # in doca-ofed 2.9.3. |
| 58 | + - name: Ensure doca-ofed is not present (upgrading it brings dkms) |
| 59 | + ansible.builtin.dnf: |
| 60 | + name: doca-ofed |
| 61 | + state: absent |
| 62 | + autoremove: false |
| 63 | + become: true |
| 64 | + |
| 65 | + - name: Ensure latest doca-ofed-userspace instead of doca-ofed |
| 66 | + ansible.builtin.dnf: |
| 67 | + name: doca-ofed-userspace |
| 68 | + state: latest |
| 69 | + become: true |
| 70 | + |
| 71 | + - name: Upgrade all |
| 72 | + ansible.builtin.dnf: |
| 73 | + name: "*" |
| 74 | + state: latest |
| 75 | + become: true |
| 76 | + |
| 77 | +- name: Fix potential grub config preventing new kernel from being used |
| 78 | + ansible.builtin.import_playbook: reset-bls-entries.yml |
| 79 | + vars: |
| 80 | + reset_bls_hosts: mlnx |
| 81 | + |
| 82 | +- name: Reboot to apply updates |
| 83 | + ansible.builtin.import_playbook: reboot.yml |
| 84 | + vars: |
| 85 | + reboot_hosts: mlnx |
| 86 | + |
| 87 | +- name: Confirm the host is upgraded to Rocky Linux 9.7 |
| 88 | + hosts: mlnx |
| 89 | + tags: post |
| 90 | + tasks: |
| 91 | + - name: Update distribution facts |
| 92 | + ansible.builtin.setup: |
| 93 | + filter: "{{ kayobe_ansible_setup_filter }}" |
| 94 | + gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" |
| 95 | + |
| 96 | + # Can fail (eg in multinode) when there are bad entries in grub config |
| 97 | + # Fixed by `kayobe playbook run ansible/maintenance/reset-bls-entries.yml` |
| 98 | + # and manual reboot |
| 99 | + - name: Assert that hosts are now using Rocky Linux 9.7 |
| 100 | + ansible.builtin.assert: |
| 101 | + that: |
| 102 | + - ansible_facts.distribution == 'Rocky' |
| 103 | + - ansible_facts.distribution_version == '9.7' |
| 104 | + - os_distribution == 'rocky' |
0 commit comments