Bug 2079008

Summary: All roles should support running with gather_facts: false
Product: Red Hat Enterprise Linux 8 Reporter: Rich Megginson <rmeggins>
Component: rhel-system-rolesAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: unspecified Docs Contact: Gabi Fialová <gfialova>
Priority: unspecified    
Version: 8.7CC: djez, gfialova, jharuda, nhosoi, rhel-cs-system-management-subsystem-qe, spetrosi
Target Milestone: rcKeywords: Triaged
Target Release: 8.7   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhel-system-roles-1.19.1-1.el8 Doc Type: Enhancement
Doc Text:
.RHEL System Roles now available also in playbooks with fact gathering disabled Ansible fact gathering might be disabled in your environment for performance or other reasons. Previously, it was not possible to use RHEL System Roles in such configurations. With this update, the system detects the `ANSIBLE_GATHERING=explicit` parameter in your configuration and `gather_facts: false` parameter in your playbooks, and use the `setup:` module to gather only the facts required by the given role, if not available from the fact cache. NOTE: If you have disabled Ansible fact gathering due to performance, you can enable Ansible fact caching instead, which does not cause a performance hit of retrieving them from source.
Story Points: ---
Clone Of: 2078989 Environment:
Last Closed: 2022-11-08 09:41:24 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:
Bug Depends On: 2078989    
Bug Blocks: 2078999, 2079009, 2100558, 2100559, 2162788    

Description Rich Megginson 2022-04-26 17:08:51 UTC
+++ This bug was initially created as a clone of Bug #2078989 +++

Description of problem:
Some users use `gather_facts: false` in their playbooks, due to performance issues with fact gathering, or other reasons.  However, this breaks system roles because almost all of them require some sort of facts like `os_family`, `distribution`, etc. to be defined.  The system roles should work if fact gathering is disabled in the playbook.

NOTE: This may require the user to enable fact caching, or simply not use the system roles if it is not possible to use fact gathering at all.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

--- Additional comment from Rich Megginson on 2022-04-26 16:41:29 UTC ---

Ansible by default will always gather facts in playbooks.  In order to test, you can use https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-gathering to disable fact gathering by default.

e.g. 

ANSIBLE_GATHERING=explicit ansible-playbook .... tests/tests_name.yml

--- Additional comment from Rich Megginson on 2022-04-26 17:06:32 UTC ---

NOTE: All roles currently are fixed except for the metrics role - see https://bugzilla.redhat.com/show_bug.cgi?id=2078999

Comment 3 Fedora Update System 2022-05-11 01:19:05 UTC
FEDORA-2022-2da3a47337 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2022-05-11 01:25:15 UTC
FEDORA-2022-d6e6c7c37c has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2022-05-11 01:35:36 UTC
FEDORA-2022-671a5d63e6 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 errata-xmlrpc 2022-11-08 09:41:24 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 and enhancement 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/RHEA-2022:7568