|
| 1 | +# Red Hat Enterprise Linux |
| 2 | + |
| 3 | +# Version lock packages to prevent them being updated. Unfortunately we cannot |
| 4 | +# lock a package before it is installed. |
| 5 | +# The generic "install packages" task in ansible/roles/baselayout/tasks/main.yml |
| 6 | +# doesn't allow downgrading, which means if a package is already installed at |
| 7 | +# a later version, specifying the version to install will not downgrade to that |
| 8 | +# version. So here we check the version and downgrade if necessary before |
| 9 | +# version locking to ensure we get what we want. |
| 10 | + |
| 11 | +- name: get installed clang version |
| 12 | + ansible.builtin.command: clang -dumpversion |
| 13 | + changed_when: false |
| 14 | + check_mode: false |
| 15 | + register: clang_dumpversion_result |
| 16 | + |
| 17 | +- name: get installed rust version |
| 18 | + ansible.builtin.command: rustc -vV |
| 19 | + changed_when: false |
| 20 | + check_mode: false |
| 21 | + register: rustc_vv_result |
| 22 | + |
| 23 | +# We don't need this. Get rid of it to simplify the number of packages to lock. |
| 24 | +- name: remove tracker-miners packages |
| 25 | + ansible.builtin.dnf: |
| 26 | + autoremove: true |
| 27 | + name: tracker-miners |
| 28 | + state: absent |
| 29 | + |
| 30 | +- name: downgrade packages |
| 31 | + ansible.builtin.dnf: |
| 32 | + allow_downgrade: true |
| 33 | + name: |
| 34 | + - llvm-toolset-{{rhel_llvm_version}} |
| 35 | + - rust-toolset-{{rhel_rust_version}} |
| 36 | + state: present |
| 37 | + when: 'clang_dumpversion_result.rc != 0 or clang_dumpversion_result.stdout != rhel_llvm_version or |
| 38 | + rustc_vv_result.rc != 0 or "release: " + rhel_rust_version not in rustc_vv_result.stdout_lines' |
| 39 | + |
| 40 | +# Lock dependent packages as well to prevent those being updated. |
| 41 | +- name: lock package versions |
| 42 | + community.general.dnf_versionlock: |
| 43 | + name: |
| 44 | + - cargo-{{rhel_rust_version}} |
| 45 | + - clang-{{rhel_llvm_version}} |
| 46 | + - clang-libs-{{rhel_llvm_version}} |
| 47 | + - clang-resource-filesystem-{{rhel_llvm_version}} |
| 48 | + - compiler-rt-{{rhel_llvm_version}} |
| 49 | + - libomp-{{rhel_llvm_version}} |
| 50 | + - libomp-devel-{{rhel_llvm_version}} |
| 51 | + - lld-{{rhel_llvm_version}} |
| 52 | + - lld-libs-{{rhel_llvm_version}} |
| 53 | + - llvm-{{rhel_llvm_version}} |
| 54 | + - llvm-libs-{{rhel_llvm_version}} |
| 55 | + - llvm-toolset-{{rhel_llvm_version}} |
| 56 | + - rust-{{rhel_rust_version}} |
| 57 | + - rust-std-static-{{rhel_rust_version}} |
| 58 | + - rust-toolset-{{rhel_rust_version}} |
| 59 | + - rustfmt-{{rhel_rust_version}} |
| 60 | + state: present |
0 commit comments