Skip to content

Commit

Permalink
Merge pull request #761 from rabi/refine_facts
Browse files Browse the repository at this point in the history
Refine ansible_facts collection
  • Loading branch information
openshift-merge-bot[bot] committed Sep 24, 2024
2 parents ff87359 + ebc1c08 commit b0e3e79
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 11 deletions.
5 changes: 4 additions & 1 deletion molecule/common/test_deps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

- name: Gather facts if they don't exist
ansible.builtin.setup:
gather_subset: min
gather_subset:
- "!all"
- "!min"
- "distribution"
when: "'distribution' not in ansible_facts"
tags:
- always
Expand Down
6 changes: 5 additions & 1 deletion roles/edpm_bootstrap/tasks/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@

- name: Gather facts if they don't exist
ansible.builtin.setup:
gather_subset: min
gather_subset:
- "!all"
- "!min"
- "distribution"
when: "'distribution' not in ansible_facts"
tags:
- always


# Currently only supported on RHEL as edpm does not have a version package

- name: Install release version package
Expand Down
6 changes: 5 additions & 1 deletion roles/edpm_frr/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@
Please check value of Ansible variable edpm_frr_bgp_uplinks.
- name: Gather facts if they don't exist
when: "'system' not in ansible_facts"
ansible.builtin.setup:
gather_subset: min
gather_subset:
- "!all"
- "!min"
- "system"

- name: Configure FRR
ansible.builtin.template:
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_frr/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_logrotate_crond/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_network_config/tasks/network_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_neutron_metadata/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
6 changes: 5 additions & 1 deletion roles/edpm_neutron_ovn/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@
when: cacert_bundle_exists.stat.exists

- name: Gather facts if they don't exist
when: "'system' not in ansible_facts"
ansible.builtin.setup:
gather_subset: min
gather_subset:
- "!all"
- "!min"
- "system"

- name: Configure neutron configuration files
block:
Expand Down
1 change: 1 addition & 0 deletions roles/edpm_nodes_validation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# under the License.

- name: Collect default network fact
when: "'default_ipv4' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- '!all'
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_ovn/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_ovn_bgp_agent/tasks/install_ovn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

- name: Gather SELinux fact if needed
when:
- ansible_facts.selinux is undefined
- "'selinux' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down
2 changes: 1 addition & 1 deletion roles/edpm_podman/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

- name: Ensure we get the ansible interfaces facts
when:
- ansible_facts['interfaces'] is undefined
- "'interfaces' not in ansible_facts"
ansible.builtin.setup:
gather_subset:
- '!all'
Expand Down
4 changes: 4 additions & 0 deletions roles/edpm_ssh_known_hosts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
- _ssh_known_hosts.stat.exists | bool

- name: Gather facts if they don't exist
when:
- ("'ssh_host_key_rsa_public' not in ansible_facts") or
("'ssh_host_key_ed25519_public' not in ansible_facts") or
("'ssh_host_key_ecdsa_public' not in ansible_facts")
ansible.builtin.setup:
gather_subset:
- "!all"
Expand Down

0 comments on commit b0e3e79

Please sign in to comment.