diff options
| author | Mark Goddard <mark@stackhpc.com> | 2024-01-26 14:27:33 +0000 |
|---|---|---|
| committer | Mark Goddard <mark@stackhpc.com> | 2025-02-05 23:15:53 +0000 |
| commit | 94b4adae2f0f9ed85e4dc3ffd56ff6c9ef13d6a3 (patch) | |
| tree | cc5a6e038e7a54aa92f1df025ade7127999c4e5a /ansible | |
| parent | 7531de2133e05b03c3470ce4e2c372947d9240af (diff) | |
| download | kolla-ansible-94b4adae2f0f9ed85e4dc3ffd56ff6c9ef13d6a3.tar.gz kolla-ansible-94b4adae2f0f9ed85e4dc3ffd56ff6c9ef13d6a3.zip | |
Support reducing scope of delegated fact gathering
When Kolla Ansible is executed with a '--limit' argument, the scope of
an operation is limited to the hosts in the limit. For example:
kolla-ansible deploy --limit control
Due to the nature of configuring clustered software services, there are
cases where we need to know information about other hosts. Most often
this is related to their hostname or network addresses. To make this
work, Kolla Ansible gathers facts for hosts outside of the limit using
delegated fact gathering [1].
By default, Kolla Ansible gathers facts for all hosts. Because delegated
facts are gathered serially in batches by the active hosts, this can
take a long time when there are not many hosts in the limit.
This change makes it possible to reduce the set of hosts eligible for
delegated fact gathering by setting 'kolla_ansible_delegate_facts_hosts'
to a list of hosts.
[1] https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html#delegating-facts
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/899615
Change-Id: Id0bda00b81b5bc6a9a870e231335c33d9828e95f
Diffstat (limited to 'ansible')
| -rw-r--r-- | ansible/gather-facts.yml | 2 | ||||
| -rw-r--r-- | ansible/group_vars/all.yml | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ansible/gather-facts.yml b/ansible/gather-facts.yml index a30c7f4ed..468b5ae69 100644 --- a/ansible/gather-facts.yml +++ b/ansible/gather-facts.yml @@ -44,7 +44,7 @@ batch_size: "{{ ansible_play_batch | length }}" # Use a python list slice to divide the group up. # Syntax: [<start index>:<end index>:<step size>] - delegate_hosts: "{{ groups['all'][batch_index | int::batch_size | int] }}" + delegate_hosts: "{{ kolla_ansible_delegate_facts_hosts[batch_index | int::batch_size | int] }}" tasks: - name: Gather facts setup: diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 7ee3f0b8f..4e1091414 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -36,6 +36,12 @@ kolla_ansible_setup_filter: "{{ omit }}" # By default, we do not provide a gather subset. kolla_ansible_setup_gather_subset: "{{ omit }}" +# This variable determines which hosts require facts when using --limit. Facts +# will be gathered using delegation for hosts in this list that are not +# included in the limit. +# By default, this list includes all hosts. +kolla_ansible_delegate_facts_hosts: "{{ groups['all'] }}" + ################### # Kolla options ################### |
