From 029c5ae4af92bd4d3cbcd10964fd00eecace5731 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Thu, 29 Dec 2016 09:33:45 +0800 Subject: [PATCH] Move nova precheck into its own role Change-Id: I1d9a0f0ed3d50acb1828d0894413a9adc7f21b2a Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 46 ++++++++++ ansible/roles/nova/tasks/precheck.yml | 49 +++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 84 ------------------- 3 files changed, 95 insertions(+), 84 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index c5fec9d107..b2f88f9d1d 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -201,6 +201,52 @@ - "{{ 'neutron_server' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Nova API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ nova_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_nova | bool + - "{{ 'nova_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Nova Metadata HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ nova_metadata_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_nova | bool + - "{{ 'nova_metadata' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Nova NoVNC HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ nova_novncproxy_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_nova | bool + - "{{ 'nova_novncproxy' not in haproxy_stat }}" + - nova_console == 'novnc' + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Nova Spice HTML5 HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ nova_spicehtml5proxy_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_nova | bool + - "{{ 'nova_spicehtml5proxy' not in haproxy_stat }}" + - nova_console == 'spice' + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Sahara API HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/nova/tasks/precheck.yml b/ansible/roles/nova/tasks/precheck.yml index ed97d539c0..5edcaa26c8 100644 --- a/ansible/roles/nova/tasks/precheck.yml +++ b/ansible/roles/nova/tasks/precheck.yml @@ -1 +1,50 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - nova_api + - nova_novncproxy + - nova_spicehtml5proxy + register: container_facts + +- name: Checking free port for Nova API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ nova_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['nova_api'] is not defined + - inventory_hostname in groups['nova-api'] + +- name: Checking free port for Nova Metadata + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ nova_metadata_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['nova_api'] is not defined + - inventory_hostname in groups['nova-api'] + +- name: Checking free port for Nova NoVNC Proxy + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ nova_novncproxy_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['nova_novncproxy'] is not defined + - nova_console == 'novnc' + - inventory_hostname in groups['nova-novncproxy'] + +- name: Checking free port for Nova Spice HTML5 Proxy + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ nova_spicehtml5proxy_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['nova_spicehtml5proxy'] is not defined + - nova_console == 'spice' + - inventory_hostname in groups['nova-spicehtml5proxy'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index f7b8649011..ae11b6e0a0 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -233,90 +233,6 @@ - enable_murano | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for Nova API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ nova_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - inventory_hostname in groups['nova-api'] - -- name: Checking free port for Nova API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ nova_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Nova Metadata - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ nova_metadata_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - inventory_hostname in groups['nova-api'] - -- name: Checking free port for Nova Metadata HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ nova_metadata_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Nova NoVNC Proxy - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ nova_novncproxy_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - nova_console == 'novnc' - - inventory_hostname in groups['nova-novncproxy'] - -- name: Checking free port for Nova NoVNC HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ nova_novncproxy_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - nova_console == 'novnc' - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Nova Spice HTML5 Proxy - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ nova_spicehtml5proxy_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - nova_console == 'spice' - - inventory_hostname in groups['nova-spicehtml5proxy'] - -- name: Checking free port for Nova Spice HTML5 HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ nova_spicehtml5proxy_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_nova | bool - - nova_console == 'spice' - - inventory_hostname in groups['haproxy'] - - name: Checking free port for RabbitMQ wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"