sap_install_media_detect: test if CRB repo is responsive
Ansible Role
sap_install_media_detect
OS Family
RHEL
Ansible Controller - Python version
Python 3.13.3
Ansible-core version
ansible [core 2.16.13]
Bug Description
codeready OS Package Repo is not enabled as standard on RHEL OS Images, and may not be tested. When enabling epel OS Package Repo, best practice is to enable codeready before - but it is not mandatory for successful installation of unar.
See below stdout of failure where codeready was non-responsive, the workaround is to disable the repo in subscription-manager and remove from the yum repos file - then the Ansible Task will be automatically skipped.
A small test would stop this panic failure that stops the Ansible Role from executing correctly:
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Detect the presence of the epel-release package] ********************************
ok: [sap-test] =>
changed: false
cmd:
- rpm
- -q
- epel-release
- --qf
- '%{NAME}'
failed_when_result: false
msg: non-zero return code
rc: 1
stderr: ''
stdout: package epel-release is not installed
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key] ********************************************************
changed: [sap-test] =>
attempts: 1
changed: true
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo] ***********************************************************
changed: [sap-test] =>
attempts: 1
changed: true
msg: ''
rc: 0
results:
- Installed /root/.ansible/tmp/ansible-tmp-1748958005.34753-95973-31054622192967/epel-release-latest-9.noarchf6oj60ap.rpm
- 'Installed: epel-release-9-10.el9.noarch'
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Enable the CRB repo] ************************************************************
changed: [sap-test] =>
changed: true
cmd:
- /usr/bin/crb
- enable
msg: ''
rc: 0
stderr: ''
stdout: |-
Enabling CRB repo
Repository 'codeready-builder-for-rhel-9-x86_64-rpms' is enabled for this system.
CRB repo is enabled and named: codeready-builder-for-rhel-9-x86_64-rpms
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Install the unar package] *******************************************************
fatal: [sap-test]: FAILED! =>
changed: false
msg: 'Failed to download metadata for repo ''codeready-builder-for-rhel-9-x86_64-rpms'':
Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were
tried'
rc: 1
results: []
Bug reproduction
Edit URL in repo file for codeready, so that it causes HTTP 404 error. This simulate the error above.
Community participation
Unfortunately I am not in a position to help with the bug fix
Update, running subscription-manager repos --disable=codeready-builder-for-rhel-9-x86_64-rpms is enough to trigger the skip:
TASK [community.sap_install.sap_install_media_detect : SAP Install Media Detect - Prepare - EPEL - Enable the CRB repo] ************
skipping: [sap-test2] =>
changed: false
false_condition: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release'
skip_reason: Conditional result was False