From 152ae97a76597167e82029f5b9d245d4515e9e37 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Wed, 30 Nov 2016 03:00:34 +0800 Subject: [PATCH] Move aodh precheck into its own role Refer to https://review.openstack.org/#/c/399354/ Change-Id: I934ff074cb795b971f79ecce008931cc672f1932 Partially-implements: blueprint condition-pre-check --- ansible/roles/aodh/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/aodh/tasks/precheck.yml b/ansible/roles/aodh/tasks/precheck.yml index ed97d539c0..89413eac7f 100644 --- a/ansible/roles/aodh/tasks/precheck.yml +++ b/ansible/roles/aodh/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - aodh_api + register: container_facts + +- name: Checking free port for Aodh API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ aodh_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['aodh_api'] is not defined + - inventory_hostname in groups['aodh-api'] diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 066a776b5f..ffac091162 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -14,6 +14,17 @@ - set_fact: haproxy_stat: "{{ haproxy_stat_shell.stdout|default('') }}" +- name: Checking free port for Aodh API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ aodh_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_aodh | bool + - "{{ 'aodh_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Barbican 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 24f6331129..3dd53cd016 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -33,26 +33,6 @@ kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none" when: enable_haproxy | bool -- name: Checking free port for Aodh API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ aodh_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_aodh | bool - - inventory_hostname in groups['aodh-api'] - -- name: Checking free port for Aodh API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ aodh_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_aodh | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Congress API wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"