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

This commit is contained in:
Zuul 2020-09-21 08:34:46 +00:00 committed by Gerrit Code Review
commit 946dbf8dc2
2 changed files with 6 additions and 4 deletions

View File

@ -43,7 +43,7 @@
- import_tasks: db_setup.yml
when:
- inventory_hostname == groups['barbican_all'][0]
- _barbican_is_first_play_host
vars:
_oslodb_setup_host: "{{ barbican_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ barbican_db_setup_python_interpreter }}"
@ -60,7 +60,7 @@
- import_tasks: mq_setup.yml
when:
- inventory_hostname == groups['barbican_all'][0]
- _barbican_is_first_play_host
vars:
_oslomsg_rpc_setup_host: "{{ barbican_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ barbican_oslomsg_rpc_userid }}"
@ -109,7 +109,7 @@
- import_tasks: barbican_db_sync.yml
when:
- inventory_hostname == groups['barbican_all'][0]
- _barbican_is_first_play_host
tags:
- barbican-config
@ -146,7 +146,7 @@
type: "{{ barbican_service_type }}"
description: "{{ barbican_service_description }}"
when:
- inventory_hostname == groups['barbican_all'][0]
- _barbican_is_first_play_host
tags:
- barbican-config

View File

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