From e85025eccb47b3b17aaefa8491c536db66b22a00 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Wed, 28 Dec 2016 18:15:53 +0100 Subject: [PATCH] Move mistral precheck into its own role Co-Authored-By: caoyuan Change-Id: Ibc1b5134173f9cdfbfe8a059e5354497fa5dae4e Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 11 ++++++++++ ansible/roles/mistral/tasks/precheck.yml | 15 ++++++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 20 ------------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 8e7caa4925..c87acbce1c 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -168,6 +168,17 @@ - "{{ 'manila_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Mistral API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ mistral_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_mistral | bool + - "{{ 'mistral_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Neutron Server HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/mistral/tasks/precheck.yml b/ansible/roles/mistral/tasks/precheck.yml index ed97d539c0..0b6001871a 100644 --- a/ansible/roles/mistral/tasks/precheck.yml +++ b/ansible/roles/mistral/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - mistral_api + register: container_facts + +- name: Checking free port for Mistral API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ mistral_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['mistral_api'] is not defined + - inventory_hostname in groups['mistral-api'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index c4951cb2e0..893772d786 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -580,26 +580,6 @@ - enable_grafana | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for Mistral API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ mistral_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mistral | bool - - inventory_hostname in groups['mistral-api'] - -- name: Checking free port for Mistral API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ mistral_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mistral | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Searchlight API wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"