Unable to add redhat 8.4 repository

Problem:
I am trying to enable the Redhat 8.4 repositories through ansible-playbook using theforeman.foreman.repository_set ansible module, but it is not getting added. But when I try to enable the Redhat 7.9 repositories, it’s working.
Expected outcome:
Redhat 8.4 repository should be enabled
Foreman and Proxy versions:
latest
Foreman and Proxy plugin versions:

Distribution and version:
RHEL 8
Other relevant data:
I am using the below playbook for enabling RHEL 8.4 repository

- hosts: localhost
  tasks:
    - name: "Enable RHEL 8 RPMs repositories"
      theforeman.foreman.repository_set:
        username: "admin"
        password: "admin"
        server_url: "myhost.com"
        label: "rhel-8-for-x86_64-baseos-rpms"
        organization: "org"
        repositories:
        - releasever: "8.4"
          basearch: "x86_64"
        state: enabled

The error I am getting is

FAILED! => {"changed": false, "msg": "Desired repositories are not available on the repository set label: rhel-8-for-x86_64-baseos-rpms.\nSearched: {'label': 'rhel-8-for-x86_64-baseos-rpms', 'repositories': [{'releasever': '8.4', 'basearch': 'x86_64'}]}\nFound: []\nAvailable: [{'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8', 'repositories': {'releasever': '8'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.6', 'repositories': {'releasever': '8.6'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.5', 'repositories': {'releasever': '8.5'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.4', 'repositories': {'releasever': '8.4'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.3', 'repositories': {'releasever': '8.3'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.2', 'repositories': {'releasever': '8.2'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.1', 'repositories': {'releasever': '8.1'}}, {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.0', 'repositories': {'releasever': '8.0'}}]"}

Also, If I change the label to RHEL 7.9, it is working fine.
Any help would be appreciated

RHEL8 repos don’t have a basearch anymore, drop that.

Okay, what about rhel-8-for-x86_64-appstream-rpms? @evgeni

same, it’s a rhel8 repo :wink:

Cool! it worked! Thanks for yout time. Basearch was the issue

That’s actually what the error is trying to tell you:

Searched: {'label': 'rhel-8-for-x86_64-baseos-rpms', 'repositories': [{'releasever': '8.4', 'basearch': 'x86_64'}]}
Found: []
Available: [
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8', 'repositories': {'releasever': '8'}}, 
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.6', 'repositories': {'releasever': '8.6'}},
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.5', 'repositories': {'releasever': '8.5'}}, 
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.4', 'repositories': {'releasever': '8.4'}}, 
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.3', 'repositories': {'releasever': '8.3'}}, 
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.2', 'repositories': {'releasever': '8.2'}},
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.1', 'repositories': {'releasever': '8.1'}}, 
  {'name': 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8.0', 'repositories': {'releasever': '8.0'}}
]

See how the repositories in the available list have no basearch?

Oh yes! Sheesh! I didn’t catch that! Thank you @evgeni

Yeah, the reporting is not really obvious, but Ansible is rather limiting here when it comes to tel they user what we think they did wrong.

1 Like

exactly!