Bug 2056582 - Ansible parser creates new OS if it runs against RHEL ComputeNode
Summary: Ansible parser creates new OS if it runs against RHEL ComputeNode
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Radek Mynar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-21 14:23 UTC by Ondrej Gajdusek
Modified: 2022-04-20 14:29 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1429033 1 None None None 2022-03-02 14:52:53 UTC

Description Ondrej Gajdusek 2022-02-21 14:23:15 UTC
Description of problem:
If the redhat-lsb-core package is installed on the system and Ansible roles are run on the RHEL ComputeNode host, a new Operating System is created.
This BZ is similar to BZ2025437 but is using a different OS variant to reproduce the behavior. Please see BZ2025437 for more details.

Version-Release number of selected component (if applicable):
@Satellite 7.0.0 snap 9
foreman-3.1.1.4-1.el8sat.noarch
rubygem-foreman_ansible-7.0.2-1.el8sat.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL 7 ComputeNode host to Satellite
2. yum install redhat-lsb-core # on the host
3. Copy capsule SSH pubkey to the host's authorized_keys
4. Run Ansible roles on the host. The host does not have to have roles assigned

Actual results:
New Operating System "Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)" is created.

Expected results:
No new operating system should be created and the existing RedHat 7.9 should be used. <-- This is a solution, which was used in BZ2025437. I expect the same for all other RHEL variants.

Additional info:
This is not a regression.

See also BZ1676493 which requests the actual behavior.

As there are multiple OS variants, the ideal fix would be to fix this behavior for all RHEL variants across all RHEL versions.

Comment 1 Marek Hulan 2022-02-22 11:55:53 UTC
If I'm not mistaken this whole set of problems appeared because we started to distinguish between the Workstation and Server. That was intended and requested by customers. Doesn't it make sense to actually keep CompueNode as a different OS than e.g. Server? Note that the provisioning template may differ for such OS.

Comment 2 Ondrej Gajdusek 2022-02-22 16:09:36 UTC
I do not track the customer requests, so I do not have the full picture of it. I do not have a strong opinion on keeping ComputeNode as a separate OS. I just care about the consistency of Satellite behavior. The thing is that RHSM reports ComputeNode as RedHat 7.9, but Ansible creates a new OS entity and assigns it to the host on which the roles were run.

Looking at what you have stated in comment1 I suggest reverting the patch you made to the Ansible fact parser and making a new one for RHSM facts parser so it reports the ComputeNode system as ComputeNode, not a RedHat.

Comment 7 Ondrej Gajdusek 2022-04-20 14:29:12 UTC
Register the host to Satellite:
subscription-manager register --org="Default_Organization" --activationkey="ak1"

See the host entity:
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: RedHat 7.9
    Id: 2

List all defined OSes:
hammer --output yaml os list
---
- Id: 2
  Title: RedHat 7.9
  Release name: 
  Family: Redhat
- Id: 1
  Title: RHEL 8.5
  Release name: 
  Family: Redhat

On the host, install redhat-lsb-core package. This is a key step that affects Ansible parser behavior.
# yum install redhat-lsb-core

In the Sat WebUI, run Ansible roles on the host to let Foreman's Ansible parser parse the host facts.

Lookup the host, and see that the assigned OS has changed.
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)
    Id: 4

List all OSes to see the new OS entity:
# hammer --output yaml os list
---
- Id: 2
  Title: RedHat 7.9
  Release name: 
  Family: Redhat
- Id: 4
  Title: Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)
  Release name: 
  Family: Redhat
- Id: 1
  Title: RHEL 8.5
  Release name: 
  Family: Redhat
  
On the host, upload the host facts to Satellite so it gets parsed using the RHSM facts parser:
# subscription-manager facts --update
Successfully updated the system facts.

Verify that the assigned OS changed back:
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: RedHat 7.9
    Id: 2
    

Actual behavior:
The OS assigned to the host varies on the facts parser used as well as on the system packages installed. When there is redhat-lsb-core package installed, the Ansible facts parser makes Foreman change the OS of the host. If the host facts get uploaded again using the RHSM facts parser, the host OS changes again.

From the discussion with Marek and per what is stated in BZ1429033 the current behavior is:
Red Hat Enterprise Linux Server 7.9 -> RedHat 7.9 
Red Hat Enterprise Linux Workstation 7.9 -> RedHat_Workstation 7.9

The behavior that was observed in the case of the ComputeNode variant.
Red Hat Enterprise Linux ComputeNode 7.9 -> RedHat 7.9 # without having redhat-lsb-core package installed
Red Hat Enterprise Linux ComputeNode 7.9 -> Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo) # redhat-lsb-core package installed


Expected behavior:
The host should have always the same OS assigned. All fact parsers should always report the same OS no matter the packages installed.


Note You need to log in before you can comment on or make changes to this bug.