From 716a66e5d34ec9b8b73eb1b4e94a0ec2e6115a0a Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Tue, 16 Feb 2021 12:34:58 -0500 Subject: [PATCH] facts.yaml: reduce the number of setup calls by ~7x (#7286) Before this commit, we were gathering: 1 !all 7 network 7 hardware After we are gathering: 1 !all 1 network 1 hardware ansible_distribution_major_version is gathered by '!all' Signed-off-by: Etienne Champetier (cherry picked from commit fb8b0751103790daea52d1c1813e087b25126235) --- facts.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/facts.yml b/facts.yml index a599f1371..e0281ee40 100644 --- a/facts.yml +++ b/facts.yml @@ -7,15 +7,20 @@ setup: gather_subset: '!all' - - name: Gather necessary facts + # filter match the following variables: + # ansible_default_ipv4 + # ansible_default_ipv6 + # ansible_all_ipv4_addresses + # ansible_all_ipv6_addresses + - name: Gather necessary facts (network) setup: - gather_subset: '!all,!min,network,hardware' - filter: "{{ item }}" - loop: - - ansible_distribution_major_version - - ansible_default_ipv4 - - ansible_default_ipv6 - - ansible_all_ipv4_addresses - - ansible_all_ipv6_addresses - - ansible_memtotal_mb - - ansible_swaptotal_mb + gather_subset: '!all,!min,network' + filter: "ansible_*_ipv[46]*" + + # filter match the following variables: + # ansible_memtotal_mb + # ansible_swaptotal_mb + - name: Gather necessary facts (hardware) + setup: + gather_subset: '!all,!min,hardware' + filter: "ansible_*total_mb"