From 14dcab0ceed3e89b64b16f62897a1cc281b82f18 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Wed, 28 Dec 2016 11:22:33 +0800 Subject: [PATCH] Move gnocchi precheck into its own role Change-Id: I6514284ff2f67ec20f37c6953ad5f8fd36a4e90f Partially-implements: blueprint condition-pre-check --- ansible/roles/gnocchi/tasks/precheck.yml | 15 ++++++++++++++ ansible/roles/haproxy/tasks/precheck.yml | 11 ++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 20 ------------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ansible/roles/gnocchi/tasks/precheck.yml b/ansible/roles/gnocchi/tasks/precheck.yml index ed97d539c0..2a3f65770b 100644 --- a/ansible/roles/gnocchi/tasks/precheck.yml +++ b/ansible/roles/gnocchi/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - gnocchi_api + register: container_facts + +- name: Checking free port for Gnocchi API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ gnocchi_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['gnocchi_api'] is not defined + - inventory_hostname in groups['gnocchi-api'] diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 22dafd1a9e..7df879df81 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -58,6 +58,17 @@ - inventory_hostname in groups['haproxy'] - "{{ 'glance_registry' not in haproxy_stat }}" +- name: Checking free port for Gnocchi API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ gnocchi_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_gnocchi | bool + - "{{ 'gnocchi_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Heat 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 65d6146874..7a8c51cbb6 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -133,26 +133,6 @@ - enable_etcd | bool - inventory_hostname in groups['etcd'] -- name: Checking free port for Gnocchi API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ gnocchi_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_gnocchi | bool - - inventory_hostname in groups['gnocchi-api'] - -- name: Checking free port for Gnocchi API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ gnocchi_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_gnocchi | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Kuryr wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"