From 90917100f20f0a7c5022d97dc7816a5d7260569b Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Mon, 16 Jan 2017 15:12:43 -0300 Subject: [PATCH] Move some prechecks into its own role To avoid many merge conflicts and re-works * Solum * iscsi * Keystone * elasticsearch Change-Id: Ibaecda35597cf39c602919b4990579f7cfc75c22 Co-Authored-By: caoyuan Co-Authored-By: qiankun.zhang Partially-implements: blueprint condition-pre-check --- .../roles/elasticsearch/tasks/precheck.yml | 15 ++++++ ansible/roles/haproxy/tasks/precheck.yml | 32 ++++++++++++ ansible/roles/iscsi/tasks/precheck.yml | 15 ++++++ ansible/roles/prechecks/tasks/port_checks.yml | 50 ------------------- 4 files changed, 62 insertions(+), 50 deletions(-) diff --git a/ansible/roles/elasticsearch/tasks/precheck.yml b/ansible/roles/elasticsearch/tasks/precheck.yml index ed97d539c0..ee10831bdb 100644 --- a/ansible/roles/elasticsearch/tasks/precheck.yml +++ b/ansible/roles/elasticsearch/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - elasticsearch + register: container_facts + +- name: Checking free port for Elasticsearch + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ elasticsearch_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['elasticsearch'] is not defined + - inventory_hostname in groups['elasticsearch'] diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 89290b0169..9d9fcb53f3 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -91,6 +91,17 @@ - inventory_hostname in groups['haproxy'] - "{{ 'designate_api' not in haproxy_stat }}" +- name: Checking free port for Elasticsearch HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ elasticsearch_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_elasticsearch | bool + - "{{ 'elasticsearch' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Glance API HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" @@ -423,6 +434,27 @@ - "{{ 'senlin_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Solum Application Deployment HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ solum_application_deployment_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_solum | bool + - "{{ 'solum_application_deployment' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Solum Image Builder HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ solum_image_builder_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_solum | bool + - "{{ 'solum_image_builder' not in haproxy_stat }}" + - name: Checking free port for Swift Proxy Server HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/iscsi/tasks/precheck.yml b/ansible/roles/iscsi/tasks/precheck.yml index ed97d539c0..0f7eaf8c2f 100644 --- a/ansible/roles/iscsi/tasks/precheck.yml +++ b/ansible/roles/iscsi/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - iscsid + register: container_facts + +- name: Checking free port for iscsi + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ iscsi_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['iscsid'] is not defined + - inventory_hostname in groups['iscsid'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index cd37a93818..d06583ee51 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -43,16 +43,6 @@ - enable_haproxy | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for iscsi - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ iscsi_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_iscsid | bool - - inventory_hostname in groups['tgtd'] - - name: Checking free port for Rsync wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" @@ -62,43 +52,3 @@ when: - inventory_hostname in groups['swift-object-server'] - enable_swift | bool - -- name: Checking free port for Solum Application Deployment - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ solum_application_deployment_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_solum | bool - - inventory_hostname in groups['solum-api'] - -- name: Checking free port for Solum Image Builder - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ solum_image_builder_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_solum | bool - - inventory_hostname in groups['solum-api'] - -- name: Checking free port for Solum Application Deployment HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ solum_application_deployment_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_solum | bool - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Solum Image Builder HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ solum_image_builder_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_solum | bool - - inventory_hostname in groups['haproxy']