From d53f27caea9193517b00eddba8d0f72774503322 Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Fri, 13 Jan 2017 11:04:14 -0300 Subject: [PATCH] Move prechecks into its own role To avoid many merge conflicts and re-works * Panko * Octavia * Ceph * MariaDB Co-Authored-By: caoyuan Partially-implements: blueprint condition-pre-check Change-Id: I3d2766d0d9f01ad4052731c7219a2d0635527ac5 --- ansible/roles/ceph/tasks/precheck.yml | 15 ++++ ansible/roles/haproxy/tasks/precheck.yml | 44 ++++++++++++ ansible/roles/mariadb/tasks/precheck.yml | 41 +++++++++++ ansible/roles/octavia/tasks/precheck.yml | 26 +++++++ ansible/roles/panko/tasks/precheck.yml | 16 +++++ ansible/roles/prechecks/tasks/port_checks.yml | 70 ------------------- 6 files changed, 142 insertions(+), 70 deletions(-) create mode 100644 ansible/roles/panko/tasks/precheck.yml diff --git a/ansible/roles/ceph/tasks/precheck.yml b/ansible/roles/ceph/tasks/precheck.yml index ed97d539c0..b12c5b4028 100644 --- a/ansible/roles/ceph/tasks/precheck.yml +++ b/ansible/roles/ceph/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - ceph_rgw + register: container_facts + +- name: Checking free port for RadosGW + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ rgw_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['ceph-rgw'] is not defined + - inventory_hostname in groups['ceph-rgw'] diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index efb49ac369..c13b46bff1 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -201,6 +201,17 @@ - "{{ 'manila_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for MariaDB HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ database_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_mariadb | bool + - "{{ 'mariadb' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Mistral API HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" @@ -280,6 +291,28 @@ - nova_console == 'spice' - inventory_hostname in groups['haproxy'] +- name: Checking free port for Octavia API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ octavia_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_octavia | bool + - "{{ 'octavia_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Panko API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ panko_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_panko | bool + - "{{ 'panko_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for RabbitMQ Management HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" @@ -291,6 +324,17 @@ - "{{ 'rabbitmq_management' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for RadosGW HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ rgw_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_ceph_rgw | bool + - "{{ 'radosgw' not in haproxy_stat }}" + - 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/mariadb/tasks/precheck.yml b/ansible/roles/mariadb/tasks/precheck.yml index ed97d539c0..a41e35dacb 100644 --- a/ansible/roles/mariadb/tasks/precheck.yml +++ b/ansible/roles/mariadb/tasks/precheck.yml @@ -1 +1,42 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - mariadb + register: container_facts + +- name: Checking free port for MariaDB + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ database_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['mariadb'] is not defined + +- name: Checking free port for MariaDB WSREP + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ mariadb_wsrep_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['mariadb'] is not defined + +- name: Checking free port for MariaDB IST + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ mariadb_ist_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['mariadb'] is not defined + +- name: Checking free port for MariaDB SST + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ mariadb_sst_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['mariadb'] is not defined diff --git a/ansible/roles/octavia/tasks/precheck.yml b/ansible/roles/octavia/tasks/precheck.yml index ed97d539c0..f17158a7bc 100644 --- a/ansible/roles/octavia/tasks/precheck.yml +++ b/ansible/roles/octavia/tasks/precheck.yml @@ -1 +1,27 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - octavia_api + - octavia_health_manager + register: container_facts + +- name: Checking free port for Octavia API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ octavia_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['octavia_api'] is not defined + - inventory_hostname in groups['octavia-api'] + +- name: Checking free port for Octavia Health Manager + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ octavia_health_manager_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['octavia_health_manager'] is not defined + - inventory_hostname in groups['octavia-health-manager'] diff --git a/ansible/roles/panko/tasks/precheck.yml b/ansible/roles/panko/tasks/precheck.yml new file mode 100644 index 0000000000..7fd726c9ec --- /dev/null +++ b/ansible/roles/panko/tasks/precheck.yml @@ -0,0 +1,16 @@ +--- +- name: Get container facts + kolla_container_facts: + name: + - panko_api + register: container_facts + +- name: Checking free port for Panko API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ panko_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['panko_api'] is not defined + - inventory_hostname in groups['panko-api'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index dcba40e442..a357fd40c7 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -123,56 +123,6 @@ - enable_iscsid | bool - inventory_hostname in groups['tgtd'] -- name: Checking free port for MariaDB - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ database_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mariadb | bool - - inventory_hostname in groups['mariadb'] - -- name: Checking free port for MariaDB HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ database_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mariadb | bool - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for MariaDB WSREP - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ mariadb_wsrep_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mariadb | bool - - inventory_hostname in groups['mariadb'] - -- name: Checking free port for MariaDB IST - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ mariadb_ist_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mariadb | bool - - inventory_hostname in groups['mariadb'] - -- name: Checking free port for MariaDB SST - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ mariadb_sst_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_mariadb | bool - - inventory_hostname in groups['mariadb'] - - name: Checking free port for Mongodb wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" @@ -312,23 +262,3 @@ when: - enable_swift | bool - inventory_hostname in groups['haproxy'] - -- name: Checking free port for RadosGW - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ rgw_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_ceph_rgw | bool - - inventory_hostname in groups['ceph-rgw'] - -- name: Checking free port for RadosGW HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ rgw_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_ceph_rgw | bool - - inventory_hostname in groups['haproxy']