From e44d57502454b96e79077591f655fb13977ad6ea Mon Sep 17 00:00:00 2001 From: caoyuan Date: Tue, 27 Dec 2016 15:38:15 +0800 Subject: [PATCH] Move searchlight precheck into its own role Change-Id: Ieb40c72bec3b1700e036b8b6ac92a27ff8802783 Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 11 ++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 20 ------------------- ansible/roles/searchlight/tasks/precheck.yml | 15 ++++++++++++++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index bbe5c86e4d..0175af31ab 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -223,6 +223,17 @@ - "{{ 'sahara_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Searchlight API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ searchlight_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_searchlight | bool + - "{{ 'searchlight_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Senlin API HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index aed211487f..fe6857d46b 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -539,23 +539,3 @@ when: - enable_ceph_rgw | bool - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Searchlight API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ searchlight_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_searchlight | bool - - inventory_hostname in groups['searchlight-api'] - -- name: Checking free port for Searchlight API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ searchlight_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_searchlight | bool - - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/searchlight/tasks/precheck.yml b/ansible/roles/searchlight/tasks/precheck.yml index ed97d539c0..30820aed16 100644 --- a/ansible/roles/searchlight/tasks/precheck.yml +++ b/ansible/roles/searchlight/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - searchlight_api + register: container_facts + +- name: Checking free port for Searchlight API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ searchlight_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['searchlight_api'] is not defined + - inventory_hostname in groups['searchlight-api']