Bug 2214282

Summary: RHC system role: activation key registration fails if system is already registered [rhel-9.2.0.z]
Product: Red Hat Enterprise Linux 9 Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: rhel-system-rolesAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: Archana Pandey <arpandey>
Severity: unspecified Docs Contact:
Priority: high    
Version: 9.2CC: arpandey, cdonnell, djez, fkrska, jharuda, pkettman, ptoscano, rmeggins, spetrosi, vdanek
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 9.2Flags: arpandey: needinfo-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:rhc
Fixed In Version: rhel-system-roles-1.21.2-1.el9_2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 2186218 Environment:
Last Closed: 2023-08-01 08:58:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2186218    
Bug Blocks:    

Comment 8 Archana Pandey 2023-06-16 16:25:27 UTC
Verification steps - 

[root@kvm-07-guest03 ~]# rpm -qa rhel-system-roles
rhel-system-roles-1.21.2-1.el9_2.noarch
[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# ansible-playbook test_activation_key_rhc.yaml 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Register with activation key] **********************************************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************************************************************************
ok: [localhost]

TASK [Register (using activation keys)] ******************************************************************************************************************************************************

TASK [rhel-system-roles.rhc : Set ansible_facts required by role] ****************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/set_vars.yml for localhost

TASK [rhel-system-roles.rhc : Ensure ansible_facts used by role] *****************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Check if insights-packages are installed] **********************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Handle insights unregistration] ********************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/insights-client-unregistration.yml for localhost

TASK [rhel-system-roles.rhc : Call insights status] ******************************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/check-insights-status.yml for localhost

TASK [rhel-system-roles.rhc : Call insights status] ******************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Unregister insights-client] ************************************************************************************************************************************
changed: [localhost]

TASK [rhel-system-roles.rhc : Handle system subscription] ************************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/subscription-manager.yml for localhost

TASK [rhel-system-roles.rhc : Ensure required packages are installed] ************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Get subscription status] ***************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Change rhsm.baseurl] *******************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Call subscription-manager] *************************************************************************************************************************************
changed: [localhost]

TASK [rhel-system-roles.rhc : Set the release] ***********************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Unset the release] *********************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Configure repositories] ****************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Handle insights registration] **********************************************************************************************************************************
skipping: [localhost]

PLAY RECAP ***********************************************************************************************************************************************************************************
localhost                  : ok=11   changed=2    unreachable=0    failed=0    skipped=6    rescued=0    ignored=0  
[root@kvm-07-guest03 ~]# 

>> system is registered at this point, now running the playbook again-


[root@kvm-07-guest03 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Disabled
Content Access Mode is set to Simple Content Access. This host has access to content, regardless of subscription status.

System Purpose Status: Disabled

[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# 
[root@kvm-07-guest03 ~]# ansible-playbook test_activation_key_rhc.yaml 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Register with activation key] **********************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************
ok: [localhost]

TASK [Register (using activation keys)] ******************************************************************************************************************************************************

TASK [rhel-system-roles.rhc : Set ansible_facts required by role] ****************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/set_vars.yml for localhost

TASK [rhel-system-roles.rhc : Ensure ansible_facts used by role] *****************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Check if insights-packages are installed] **********************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Handle insights unregistration] ********************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/insights-client-unregistration.yml for localhost

TASK [rhel-system-roles.rhc : Call insights status] ******************************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/check-insights-status.yml for localhost

TASK [rhel-system-roles.rhc : Call insights status] ******************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Unregister insights-client] ************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Handle system subscription] ************************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/subscription-manager.yml for localhost

TASK [rhel-system-roles.rhc : Ensure required packages are installed] ************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Get subscription status] ***************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Change rhsm.baseurl] *******************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Call subscription-manager] *************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Set the release] ***********************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Unset the release] *********************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Configure repositories] ****************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Handle insights registration] **********************************************************************************************************************************
skipping: [localhost]

PLAY RECAP ***********************************************************************************************************************************************************************************
localhost                  : ok=11   changed=0    unreachable=0    failed=0    skipped=6    rescued=0    ignored=0   

[root@kvm-07-guest03 ~]# 

Successfully Verified that bug is fixed.

Comment 9 Rich Megginson 2023-06-21 23:44:29 UTC
Please mark this BZ as VERIFIED

Comment 14 errata-xmlrpc 2023-08-01 08:58:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rhel-system-roles bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:4362