From 779b0f83101b572ce391f81098cfe9bc170f49cb Mon Sep 17 00:00:00 2001 From: caoyuan Date: Mon, 2 Jan 2017 22:41:38 +0800 Subject: [PATCH] Move horizon precheck into its own role Change-Id: I4e2f8e21bfd295d235d1264e427328e4baa85df3 Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 11 +++++++++ ansible/roles/horizon/tasks/precheck.yml | 15 ++++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 24 ------------------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 0d5972e777..7b6bf2f6f5 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -80,6 +80,17 @@ - "{{ 'heat_api_cfn' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Horizon HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "80" + connect_timeout: 1 + state: stopped + when: + - enable_horizon | bool + - "{{ 'horizon' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for watcher API HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/horizon/tasks/precheck.yml b/ansible/roles/horizon/tasks/precheck.yml index ed97d539c0..703b0e52b2 100644 --- a/ansible/roles/horizon/tasks/precheck.yml +++ b/ansible/roles/horizon/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - horizon + register: container_facts + +- name: Checking free port for Horizon + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "80" + connect_timeout: 1 + state: stopped + when: + - container_facts['horizon'] is not defined + - inventory_hostname in groups['horizon'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index b2427d8869..1bb441da50 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -193,30 +193,6 @@ - enable_haproxy | bool - inventory_hostname in groups['haproxy'] - - - - -- name: Checking free port for Horizon - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "80" - connect_timeout: 1 - state: stopped - when: - - enable_horizon | bool - - inventory_hostname in groups['horizon'] - -- name: Checking free port for Horizon HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "80" - connect_timeout: 1 - state: stopped - when: - - enable_horizon | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for Ironic wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"