forked from openstack/kayobe
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from stackhpc/upstream/2023.1-2024-03-18
Synchronise 2023.1 with upstream
- Loading branch information
Showing
5 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
--- | ||
gather_facts_delegated_limit_hosts: "{{ ansible_play_hosts_all }}" | ||
gather_facts_delegated_batch_index: "{{ gather_facts_delegated_limit_hosts.index(inventory_hostname) }}" | ||
gather_facts_delegated_batch_size: "{{ gather_facts_delegated_limit_hosts | length }}" | ||
gather_facts_delegated_limit_hosts: "{{ groups['overcloud'] }}" | ||
gather_facts_delegated_batch_index: "{{ ansible_play_batch.index(inventory_hostname) }}" | ||
gather_facts_delegated_batch_count: "{{ ansible_play_batch | length }}" | ||
# Use a python list slice to divide the group up. | ||
# Syntax: [<start index>:<end index>:<step size>] | ||
gather_facts_delegated_delegate_hosts: >- | ||
{{ gather_facts_delegated_limit_hosts[gather_facts_delegated_batch_index | int::gather_facts_delegated_batch_size | int] }} | ||
{{ gather_facts_delegated_limit_hosts[gather_facts_delegated_batch_index | int::gather_facts_delegated_batch_count | int] }} |
12 changes: 12 additions & 0 deletions
12
ansible/roles/gather-facts-delegated/tasks/gather-facts-delegated.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Gather facts for delegated host | ||
any_errors_fatal: true | ||
setup: | ||
filter: "{{ kayobe_ansible_setup_filter }}" | ||
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" | ||
delegate_facts: True | ||
delegate_to: "{{ delegated_host }}" | ||
# NOTE: Without this, the host's ansible_host variable will not be respected | ||
# when using delegate_to. | ||
vars: | ||
ansible_host: "{{ hostvars[delegated_host].ansible_host | default(delegated_host) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
--- | ||
- name: Gather facts for all hosts (if using --limit) | ||
setup: | ||
filter: "{{ kayobe_ansible_setup_filter }}" | ||
gather_subset: "{{ kayobe_ansible_setup_gather_subset }}" | ||
delegate_facts: True | ||
delegate_to: "{{ item }}" | ||
with_items: "{{ gather_facts_delegated_delegate_hosts }}" | ||
include_tasks: gather-facts-delegated.yml | ||
vars: | ||
delegated_host: "{{ gather_facts_delegated_delegate_hosts[item | int] }}" | ||
# Loop over the index into each host's batch, so tasks are not all included serially. | ||
with_sequence: start=0 end="{{ gather_facts_delegated_delegate_hosts | length | int - 1 }}" | ||
when: | ||
- not hostvars[item].ansible_facts | ||
- item | int < gather_facts_delegated_delegate_hosts | length | ||
- not hostvars[gather_facts_delegated_delegate_hosts[item | int]].ansible_facts |
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/fix-etc-hosts-management-6b33748ab37d6273.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixes the bug where /etc/hosts was not populated correctly when running | ||
Kayobe using a host limit. | ||
`LP#2051714 <https://launchpad.net/bugs/2051714>`__ |