From 59dd9a4444f5b4b4a6e2aa699787d440c8e80e8e Mon Sep 17 00:00:00 2001 From: zhubingbing <1392607554@qq.com> Date: Thu, 1 Dec 2016 07:34:15 +0000 Subject: [PATCH] Move watcher precheck into its own role Refers to https://review.openstack.org/#/c/399354/ Change-Id: I28f77d996593978caa3cb63f1c0b0fb096d2d62a Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 11 ++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 20 ------------------- ansible/roles/watcher/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 0dc35c9802..f0520f551d 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -35,3 +35,14 @@ - enable_glance | bool - inventory_hostname in groups['haproxy'] - "{{ 'glance_registry' not in haproxy_stat }}" + +- name: Checking free port for watcher API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ watcher_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_watcher | bool + - "{{ 'watcher_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index 1c2ee0fd99..be8131078e 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -890,26 +890,6 @@ - enable_mistral | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for Watcher API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ watcher_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_watcher | bool - - inventory_hostname in groups['watcher-api'] - -- name: Checking free port for Watcher API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ watcher_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_watcher | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Searchlight API wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" diff --git a/ansible/roles/watcher/tasks/precheck.yml b/ansible/roles/watcher/tasks/precheck.yml index ed97d539c0..d346f9ca87 100644 --- a/ansible/roles/watcher/tasks/precheck.yml +++ b/ansible/roles/watcher/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - watcher_api + register: container_facts + +- name: Checking free port for watcher API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ watcher_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['watcher_api'] is not defined + - inventory_hostname in groups['watcher-api']