Bug 2214283

Summary: RHC system role: activation key registration fails if system is already registered [rhel-8.8.0.z]
Product: Red Hat Enterprise Linux 8 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: 8.9CC: arpandey, briasmit, cdonnell, djez, fkrska, jharuda, pkettman, ptoscano, rhel-cs-system-management-subsystem-qe, rmeggins, spetrosi, vdanek
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.8Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:rhc
Fixed In Version: rhel-system-roles-1.21.2-1.el8_8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 2186908 Environment:
Last Closed: 2023-06-27 14:58:30 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: 2186908    
Bug Blocks:    

Comment 3 Archana Pandey 2023-06-15 10:57:33 UTC
Verifying bug on rhel-system-roles-1.21.2-1.el8_8.noarch against production server- 

      Beaker Test information:
                         HOSTNAME=opicee-1.4a2m.lab.eng.bos.redhat.com
                            JOBID=7975462
                         RECIPEID=14094546
                    RESULT_SERVER=
                           DISTRO=RHEL-8.8.0-updates-20230614.8
                     ARCHITECTURE=x86_64

[root@opicee-1 ~]# rpm -qa | grep rhel-system-roles
rhel-system-roles-1.21.2-1.el8_8.noarch
[root@opicee-1 ~]# 

[root@opicee-1 ~]# subscription-manager config --list | grep  hostname
   hostname = [subscription.rhsm.redhat.com]
   proxy_hostname = []
[root@opicee-1 ~]#


>> Running playbook

[root@opicee-1 ~]# 
[root@opicee-1 ~]# ansible-playbook test_actkey_org.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] *************************************************************************************************************************************
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=10   changed=1    unreachable=0    failed=0    skipped=7    rescued=0    ignored=0   


>> checking system subscription status
[root@opicee-1 ~]# 
[root@opicee-1 ~]# 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


>> re-running playbook to check if it passes on registered system

[root@opicee-1 ~]# 
[root@opicee-1 ~]# ansible-playbook test_actkey_org.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@opicee-1 ~]# 

Verification : Passed (running playbook on registered system does not fail anymore.)


Other-info: content of playbook test_actkey_org.yaml
---
- name: Register with activation key
  hosts: localhost
  vars_files:
    test_vars.yaml
  tasks:
    - name: Register (using activation keys)
      include_role:
        name: rhel-system-roles.rhc
      vars:
        rhc_auth:
          activation_keys:
            keys: "{{ keys_var }}"
        rhc_insights:
          state: absent
        rhc_organization: "{{ rhc_organization_var }}"

Comment 7 errata-xmlrpc 2023-06-27 14:58:30 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:3833