Skip to content

Commit 96216bb

Browse files
authored
feat: lock VM to RHEL9.6 and enable EUS channels (#31)
* lock VM to RHEL9.6 and enable EUS channels By default, RHEL 9 follows general RHEL 9 streams It means that after RHEL 9.7 is out, running dnf update on RHEL 9.6 pulls packages from RHEL 9.7 repositories. This change makes system install packages from RHEL 9.6.z instead of RHEL 9.7 repositories https://learn.microsoft.com/en-us/azure/virtual-machines/workloads/redhat/redhat-rhui * Change to use config file, add README
1 parent 33b5a6b commit 96216bb

File tree

8 files changed

+81
-0
lines changed

8 files changed

+81
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ from external collections. Please use the following command to install them:
2222
ansible-galaxy collection install -vv -r meta/collection-requirements.yml
2323
```
2424

25+
## Variables for Controlling Repositories
26+
27+
### hpc_enable_eus_repo
28+
29+
Whether to disable the default `rhui-azure-rhel${major_version}` repository and enable the EUS `rhui-azure-rhel${major_version}-eus` repository.
30+
31+
This is required to continue getting updates for your minor version.
32+
For example, when on RHEL 9.6, once RHEL 9.7 is released, your system will install packages from RHEL 9.7 repositories.
33+
Setting this variable to `true` locks the version to RHEL 9.6 so that you get packages from RHEL 9.6.z repositories.
34+
35+
Default: `true`
36+
37+
Type: `bool`
38+
2539
## Variables for Controlling Packages to Install
2640

2741
These variables control what packages the role installs.

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ hpc_tuning: true
2525

2626
hpc_update_kernel: true
2727
hpc_update_all_packages: false
28+
29+
hpc_enable_eus_repo: true

tasks/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,56 @@
5151
- "{{ __hpc_nvidia_cuda_repo }}"
5252
- "{{ __hpc_microsoft_prod_repo }}"
5353

54+
- name: Replace default RHUI Azure repository with the EUS repository
55+
when: hpc_enable_eus_repo
56+
block:
57+
- name: Get list of installed repositories
58+
command: dnf repolist
59+
changed_when: false
60+
register: __hpc_dnf_repolist
61+
62+
- name: Ensure that the non-EUS RHUI Azure repository is not installed
63+
package:
64+
name: rhui-azure-rhel{{ ansible_distribution_major_version }}
65+
state: absent
66+
use: "{{ (__hpc_server_is_ostree | d(false)) |
67+
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
68+
69+
- name: Enable the RHUI Azure EUS repository
70+
when: >-
71+
'rhui-microsoft-azure-rhel' + ansible_distribution_major_version
72+
+ '-eus ' not in __hpc_dnf_repolist.stdout
73+
block:
74+
- name: Create a temp file for the EUS repository configuration
75+
tempfile:
76+
state: file
77+
prefix: rhel{{ ansible_distribution_major_version }}-eus
78+
suffix: .config
79+
register: __hpc_euc_config
80+
81+
- name: Generate the repository configuration template
82+
template:
83+
src: rhel-ver-eus.config
84+
dest: "{{ __hpc_euc_config.path }}"
85+
mode: "0644"
86+
owner: root
87+
group: root
88+
89+
- name: Add EUS repository
90+
command: >-
91+
dnf --config {{ __hpc_euc_config.path }} install
92+
rhui-azure-rhel{{ ansible_distribution_major_version }}-eus
93+
--assumeyes
94+
changed_when: true
95+
96+
- name: Lock the RHEL minor release to the current minor release
97+
copy:
98+
content: "{{ ansible_distribution_version }}"
99+
dest: /etc/dnf/vars/releasever
100+
mode: "0644"
101+
owner: root
102+
group: root
103+
54104
- name: Configure firewall to use trusted zone as default
55105
when: hpc_manage_firewall
56106
include_role:

templates/rhel-ver-eus.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[rhui-microsoft-azure-rhel{{ ansible_distribution_major_version }}]
2+
name=Microsoft Azure RPMs for Red Hat Enterprise Linux {{ ansible_distribution_major_version }} (rhel{{ ansible_distribution_major_version }}-eus)
3+
baseurl=https://rhui4-1.microsoft.com/pulp/repos/unprotected/microsoft-azure-rhel{{ ansible_distribution_major_version }}-eus
4+
enabled=1
5+
gpgcheck=1
6+
sslverify=1
7+
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-microsoft-azure-release

tests/tests_default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
hpc_install_rdma: false
1515
hpc_install_system_openmpi: false
1616
hpc_build_openmpi_w_nvidia_gpu_support: false
17+
hpc_enable_eus_repo: false
1718
tasks:
1819
- name: Skip unsupported architectures
1920
include_tasks: tasks/skip_unsupported_archs.yml

tests/tests_include_vars_from_parent.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
hpc_install_rdma: false
6060
hpc_install_system_openmpi: false
6161
hpc_build_openmpi_w_nvidia_gpu_support: false
62+
hpc_enable_eus_repo: false
6263

6364
- name: Cleanup
6465
file:

tests/tests_skip_toolkit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
hpc_install_system_openmpi: false
1717
hpc_build_openmpi_w_nvidia_gpu_support: false
1818
hpc_reboot_ok: true
19+
hpc_enable_eus_repo: false
1920
tags:
2021
- tests::reboot
2122
tasks:

vars/RedHat_9.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ __hpc_microsoft_prod_repo:
1616
description: Microsoft Production repository
1717
key: https://packages.microsoft.com/keys/microsoft.asc
1818
baseurl: https://packages.microsoft.com/rhel/9/prod/
19+
__hpc_rhui_azure_rhel_9_eus_repo:
20+
name: rhui-microsoft-azure-rhel9-eus
21+
description: Microsoft Azure RPMs for Red Hat Enterprise Linux 9 EUS
22+
key: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-microsoft-azure-release
23+
baseurl: https://rhui4-1.microsoft.com/pulp/repos/unprotected/microsoft-azure-rhel9-eus
1924

2025
# Vars related to RPMs
2126
__hpc_nvidia_driver_module: nvidia-driver:575-dkms

0 commit comments

Comments
 (0)