Bug 1934115

Summary: Foreman facts callback does not work well when more facts are added from roles
Product: Red Hat Satellite Reporter: Adam Ruzicka <aruzicka>
Component: Ansible CollectionAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.9.0CC: ahumbe, egolov, mjia, oezr, osousa, smeyer, vsedmik, zhunting
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ansible-collection-redhat-satellite-2.1.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:10:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Ruzicka 2021-03-02 14:29:08 UTC
Description of problem:
The current ansible callback is inefficient 

Version-Release number of selected component (if applicable):
Foreman facts callback does not work well when more facts are added from roles

How reproducible:
Always


Steps to Reproduce:
1. Have a role which uses set_fact under the hood a bunch of times
2. Assign it to a host
3. Apply roles to the host

Actual results:
It is slow, facts are created and then destroyed again several times.


Expected results:
It is fast-ish facts are changed only once at the end of the run.


Additional info:
We upload facts for any "ok" event, given Foreman behavior, that removes all existing facts in Foreman of Ansible source. While setup phase upload all ansible_* modules, if next play introduces new fact, it deletes all facts from step one and adds just newly added facts. Also sending update for each play is not performance heavy, it's better to build the final set in memory and then send at once.

Comment 2 Brad Buckingham 2021-08-12 18:58:43 UTC
*** Bug 1989034 has been marked as a duplicate of this bug. ***

Comment 3 Vladimír Sedmík 2021-10-07 15:55:45 UTC
Verified on 6.10.0 snap 21 (ansible-collection-redhat-satellite-2.2.0-1.el7sat.noarch):
1) execution time was 2.3 times faster compared to 6.9.7 snap 1
2) all facts were successfully created (not only the last added)

Comment 6 errata-xmlrpc 2021-11-16 14:10:12 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 (Moderate: Satellite 6.10 Release), 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/RHSA-2021:4702