Skip to content

Commit

Permalink
fact gathering: Group hosts before gathering facts
Browse files Browse the repository at this point in the history
If not using --limit, each host runs the setup module for itself only.
Hosts should be able to fail at this point and drop out of execution
without affecting others. However, there is a bug that causes us to hit
the --limit code path for an unreachable host and therefore become
subject to its limitations.  These include the use of delegated fact
gathering, and failing the delegated host when the delegating host is
unreachable.

This change fixes the issue by reversing the order of two tasks in the
gather-facts.yml playbook, ensuring that we check the ansible_play_batch
variable before any hosts have had a chance to fail.

Change-Id: I4b1da63e8f0cc2774f1a9ab2e0414746108f7e12
Closes-Bug: #2041859
(cherry picked from commit 7f01f47)
  • Loading branch information
markgoddard committed Aug 21, 2024
1 parent 0cc9990 commit 1a8c74a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ansible/gather-facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
serial: '{{ kolla_serial|default("0") }}'
gather_facts: false
tasks:
- name: Group hosts to determine when using --limit
group_by:
key: "all_using_limit_{{ (ansible_play_batch | length) != (groups['all'] | length) }}"
changed_when: false

- name: Gather facts
setup:
filter: "{{ kolla_ansible_setup_filter }}"
gather_subset: "{{ kolla_ansible_setup_gather_subset }}"
when:
- not ansible_facts

- name: Group hosts to determine when using --limit
group_by:
key: "all_using_limit_{{ (ansible_play_batch | length) != (groups['all'] | length) }}"
changed_when: false
tags: always

# NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The
Expand Down

0 comments on commit 1a8c74a

Please sign in to comment.