fix: facts being gathered unnecessarily

Cause: The comparison of the present facts with the required facts is
being done on unsorted lists.

Consequence: The comparison may fail if the only difference is the
order.  Facts are gathered unnecessarily.

Fix: Use `difference` which works no matter what the order is.  Ensure
that the fact gathering subsets used are the absolute minimum required.

Result: The role gathers only the facts it requires, and does
not unnecessarily gather facts.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
Rich Megginson 2023-07-13 14:34:12 -06:00 committed by Richard Megginson
parent a83b157591
commit 751c3fffca
2 changed files with 9 additions and 3 deletions

View file

@ -132,3 +132,9 @@ __network_required_facts:
- distribution_version
- os_family
- python
# the subsets of ansible_facts that need to be gathered in case any of the
# facts in required_facts is missing; see the documentation of
# the 'gather_subset' parameter of the 'setup' module
__network_required_facts_subsets: "{{ ['!all', '!min'] +
__network_required_facts }}"