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

This commit is contained in:
Zuul 2020-09-23 17:42:11 +00:00 committed by Gerrit Code Review
commit 8c51051b0f
2 changed files with 7 additions and 7 deletions

View File

@ -25,8 +25,7 @@
- import_tasks: db_setup.yml
when:
- "magnum_services['magnum-api']['group'] in group_names"
- "inventory_hostname == ((groups[magnum_services['magnum-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_magnum_is_first_play_host"
vars:
_oslodb_setup_host: "{{ magnum_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ magnum_db_setup_python_interpreter }}"
@ -43,8 +42,7 @@
- import_tasks: mq_setup.yml
when:
- "magnum_services['magnum-api']['group'] in group_names"
- "inventory_hostname == ((groups[magnum_services['magnum-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- "_magnum_is_first_play_host"
vars:
_oslomsg_rpc_setup_host: "{{ magnum_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ magnum_oslomsg_rpc_userid }}"
@ -106,7 +104,7 @@
- systemd-service
- import_tasks: magnum_db_sync.yml
when: inventory_hostname == groups['magnum_all'][0]
when: _magnum_is_first_play_host
tags:
- magnum-config
@ -121,7 +119,7 @@
- uwsgi
- import_tasks: magnum_service_setup.yml
when: inventory_hostname == groups['magnum_all'][0]
when: _magnum_is_first_play_host
tags:
- magnum-config
@ -129,6 +127,6 @@
meta: flush_handlers
- import_tasks: magnum_resources.yml
when: inventory_hostname == groups['magnum_all'][0]
when: _magnum_is_first_play_host
tags:
- magnum-config

View File

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