Skip to content

Commit

Permalink
Merge pull request #257 from stackhpc/upstream/2023.1-2024-03-18
Browse files Browse the repository at this point in the history
Synchronise 2023.1 with upstream
  • Loading branch information
markgoddard authored Mar 18, 2024
2 parents 2237407 + d7d7795 commit 788eeb0
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/etc-hosts/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
customize_etc_hosts: true

# List of hosts to add to /etc/hosts.
etc_hosts_hosts: "{{ ansible_play_hosts_all }}"
etc_hosts_hosts: "{{ groups['overcloud'] }}"
8 changes: 4 additions & 4 deletions ansible/roles/gather-facts-delegated/defaults/main.yml
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] }}
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) }}"
14 changes: 7 additions & 7 deletions ansible/roles/gather-facts-delegated/tasks/main.yml
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
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>`__

0 comments on commit 788eeb0

Please sign in to comment.