From 91313d82935778eebb7a82ea4aae49c95dd1a7e5 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Wed, 28 Dec 2016 23:31:34 +0800 Subject: [PATCH] Move cinder precheck into its own role And remove the unnecessary blanks. Change-Id: Id2b5f8119c446b36c91ec0e63246c90a60459e24 Partially-implements: blueprint condition-pre-check --- ansible/roles/cinder/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/cinder/tasks/precheck.yml b/ansible/roles/cinder/tasks/precheck.yml index ed97d539c0..6e44a2c799 100644 --- a/ansible/roles/cinder/tasks/precheck.yml +++ b/ansible/roles/cinder/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - cinder_api + register: container_facts + +- name: Checking free port for Cinder API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ cinder_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['cinder_api'] is not defined + - inventory_hostname in groups['cinder-api'] diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 22dafd1a9e..0c8a982126 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -25,6 +25,17 @@ - "{{ 'barbican_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Cinder API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ cinder_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_cinder | bool + - "{{ 'cinder_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Cloudkitty 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..5034448fc6 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -93,26 +93,6 @@ - enable_congress | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for Cinder API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ cinder_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_cinder | bool - - inventory_hostname in groups['cinder-api'] - -- name: Checking free port for Cinder API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ cinder_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_cinder | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Etcd Peer wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"