aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark <mark@stackhpc.com>2024-03-08 14:33:55 +0000
committerMark <mark@stackhpc.com>2024-03-08 14:36:40 +0000
commit0d238e479b74ca618daefd73ad913b4664f2ce7a (patch)
tree6d7f3da491bde477d37d2fba169249247c3e3dd5
parent3760eac763693be589ba17e67cdc7d10b21bd4e3 (diff)
downloadkolla-ansible-0d238e479b74ca618daefd73ad913b4664f2ce7a.tar.gz
kolla-ansible-0d238e479b74ca618daefd73ad913b4664f2ce7a.zip
Avoid unnecessary secondary fact gathering failure
Previously, during fact gathering when using the '--limit' argument if a host inside the limit fails to gather facts, this would cause another host to fail during delegated fact gathering. This is because the ansible_facts variable would not be populated for the host. This change fixes the issue by avoiding delegated fact gathering for hosts inside the limit. Partial-Bug: #2041860 Change-Id: I8e321469089f0eb80420b788b51e6d028c7fef4d
-rw-r--r--ansible/gather-facts.yml6
-rw-r--r--releasenotes/notes/fact-gathering-double-failure-4662ef2f54d58291.yaml6
2 files changed, 11 insertions, 1 deletions
diff --git a/ansible/gather-facts.yml b/ansible/gather-facts.yml
index 59c9903f5..5580fb987 100644
--- a/ansible/gather-facts.yml
+++ b/ansible/gather-facts.yml
@@ -17,6 +17,7 @@
filter: "{{ kolla_ansible_setup_filter }}"
gather_subset: "{{ kolla_ansible_setup_gather_subset }}"
when:
+ # Don't gather if fact caching is in use
- not ansible_facts
- name: Gather package facts
@@ -61,8 +62,11 @@
delegate_facts: True
delegate_to: "{{ item }}"
with_items: "{{ delegate_hosts }}"
- # We gathered facts for all hosts in the batch during the first play.
when:
+ # We gathered facts for all hosts in the batch during the first play.
+ # Ensure that we don't try again if they failed.
+ - item not in groups["all_using_limit_True"]
+ # Don't gather if fact caching is in use
- not hostvars[item].ansible_facts
- name: Gather package facts
diff --git a/releasenotes/notes/fact-gathering-double-failure-4662ef2f54d58291.yaml b/releasenotes/notes/fact-gathering-double-failure-4662ef2f54d58291.yaml
new file mode 100644
index 000000000..fe0595cf4
--- /dev/null
+++ b/releasenotes/notes/fact-gathering-double-failure-4662ef2f54d58291.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+ - |
+ Fixes an issue during fact gathering when using the ``--limit`` argument
+ where a host that fails to gather facts could cause another host to fail
+ during delegated fact gathering.