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

This commit is contained in:
Zuul 2020-09-21 08:56:29 +00:00 committed by Gerrit Code Review
commit 9591efc5cb
2 changed files with 6 additions and 6 deletions

View File

@ -41,8 +41,7 @@
- import_tasks: db_setup.yml
when:
- "designate_services['designate-api']['group'] in group_names"
- "inventory_hostname == ((groups[designate_services['designate-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_designate_is_first_play_host"
vars:
_oslodb_setup_host: "{{ designate_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ designate_db_setup_python_interpreter }}"
@ -59,8 +58,7 @@
- import_tasks: mq_setup.yml
when:
- "designate_services['designate-api']['group'] in group_names"
- "inventory_hostname == ((groups[designate_services['designate-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_designate_is_first_play_host"
vars:
_oslomsg_rpc_setup_host: "{{ designate_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ designate_oslomsg_rpc_userid }}"
@ -113,7 +111,7 @@
meta: flush_handlers
- import_tasks: designate_db_sync.yml
when: inventory_hostname == groups['designate_all'][0]
when: _designate_is_first_play_host
tags:
- designate-install
@ -143,7 +141,7 @@
- name: "{{ designate_service_name }}"
type: "{{ designate_service_type }}"
description: "{{ designate_service_description }}"
when: inventory_hostname == groups['designate_all'][0]
when: _designate_is_first_play_host
tags:
- designate-install

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_designate_is_first_play_host: "{{ (designate_services['designate-api']['group'] in group_names and inventory_hostname == (groups[designate_services['designate-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.