Merge "Define condition for the first play host one time"

This commit is contained in:
Zuul 2020-09-21 08:38:03 +00:00 committed by Gerrit Code Review
commit 6a53dd4505
3 changed files with 8 additions and 10 deletions

View File

@ -108,7 +108,7 @@
dest: "{{ item.tmp_f }}"
flat: yes
changed_when: false
run_once: true
when: _glance_is_first_play_host
with_items: "{{ glance_core_files }}"
- name: Copy common config
@ -130,7 +130,7 @@
state: absent
changed_when: false
delegate_to: localhost
run_once: true
when: _glance_is_first_play_host
with_items: "{{ glance_core_files }}"
# NOTE(cloudnull): This will ensure strong permissions on all rootwrap files.

View File

@ -42,8 +42,7 @@
- import_tasks: db_setup.yml
when:
- "glance_services['glance-api']['group'] in group_names"
- "inventory_hostname == ((groups[glance_services['glance-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_glance_is_first_play_host"
vars:
_oslodb_setup_host: "{{ glance_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ glance_db_setup_python_interpreter }}"
@ -60,8 +59,7 @@
- import_tasks: mq_setup.yml
when:
- "glance_services['glance-api']['group'] in group_names"
- "inventory_hostname == ((groups[glance_services['glance-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_glance_is_first_play_host"
vars:
_oslomsg_rpc_setup_host: "{{ glance_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ glance_oslomsg_rpc_userid }}"
@ -87,8 +85,7 @@
- import_tasks: glance_db_sync.yml
when:
- "glance_services['glance-api']['group'] in group_names"
- "inventory_hostname == ((groups[glance_services['glance-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_glance_is_first_play_host"
tags:
- glance-config
@ -119,8 +116,7 @@
url: "{{ glance_service_adminurl }}"
service: "{{ glance_service_name }}"
when:
- "glance_services['glance-api']['group'] in group_names"
- "inventory_hostname == ((groups[glance_services['glance-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_glance_is_first_play_host"
tags:
- glance-config

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_glance_is_first_play_host: "{{ (glance_services['glance-api']['group'] in group_names and inventory_hostname == (groups[glance_services['glance-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.