Bug 2214287

Summary: rhc system role does not apply Insights tags [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: low Docs Contact:
Priority: high    
Version: 8.9CC: arpandey, bblasco, briasmit, cdonnell, djez, fkrska, jharuda, pkettman, ptoscano, rhel-cs-system-management-subsystem-qe, rmeggins, spetrosi, vdanek
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.8   
Hardware: All   
OS: All   
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: 2209441 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: 2209441    
Bug Blocks:    

Comment 5 Archana Pandey 2023-06-16 14:23:04 UTC
verifying bug on rhel-system-roles-1.21.2-1.el8_8.noarch

Beaker Test information:
                         HOSTNAME=kvm-08-guest10.hv2.lab.eng.bos.redhat.com
                            JOBID=7979848
                         RECIPEID=14101488
                    RESULT_SERVER=
                           DISTRO=RHEL-8.8.0-updates-20230616.8
                     ARCHITECTURE=x86_64

[root@kvm-08-guest10 ~]# rpm -qa | grep rhel-system-role
rhel-system-roles-1.21.2-1.el8_8.noarch
[root@kvm-08-guest10 ~]# 
[root@kvm-08-guest10 ~]# ll /etc/insights-client/tags.yaml
ls: cannot access '/etc/insights-client/tags.yaml': No such file or directory
[root@kvm-08-guest10 ~]#

>> running playbook 
[root@kvm-08-guest10 ~]# ansible-playbook test_tags_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] **********************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Handle insights unregistration] ********************************************************************************************************************************
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] **********************************************************************************************************************************
included: /usr/share/ansible/roles/rhel-system-roles.rhc/tasks/insights-client.yml for localhost

TASK [rhel-system-roles.rhc : Ensure required packages are installed] ************************************************************************************************************************
ok: [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 : Add insights tags] *********************************************************************************************************************************************
changed: [localhost]

TASK [rhel-system-roles.rhc : Delete insights tags] ******************************************************************************************************************************************
skipping: [localhost]

TASK [rhel-system-roles.rhc : Configure autoupdate] ******************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Register insights-client] **************************************************************************************************************************************

changed: [localhost]

TASK [rhel-system-roles.rhc : Do the collection if insights-client was registered] ***********************************************************************************************************
skipping: [localhost]

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

TASK [rhel-system-roles.rhc : Enable remediation] ********************************************************************************************************************************************
ok: [localhost]

TASK [rhel-system-roles.rhc : Disable remediation] *******************************************************************************************************************************************
skipping: [localhost]

PLAY RECAP ***********************************************************************************************************************************************************************************
localhost                  : ok=15   changed=3    unreachable=0    failed=0    skipped=10   rescued=0    ignored=0   

[root@kvm-08-guest10 ~]# cat /etc/insights-client/tags.yaml
environment: test
location:
- India
- Karnataka
- Bangalore
[root@kvm-08-guest10 ~]#

>> verifying if tags got applied in crc by accessing link https://console.redhat.com/insights/inventory/?page=1&per_page=50#SIDs=&tags=insights-client%2Flocation%3DIndia

attaching screenshot of result - attachment 1971171 [details]

Verification Result : Passed

Additional Info:

playbook content
---
- 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: present
          autoupdate: true
          remediation: present
          tags:
            environment: test
            location:
              - India
              - Karnataka
              - Bangalore
        rhc_organization: "{{ rhc_organization_var }}"

Comment 10 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