From 857a90cc31e0d97886bb9e6d44efe8474a89b71b Mon Sep 17 00:00:00 2001 From: "xu.hongzhi" Date: Fri, 13 Jan 2017 19:09:14 +0800 Subject: [PATCH] Move swift precheck into its own role Co-Authored-By: caoyuan Change-Id: If3a0a849e551b2b8973a343d1ea603ebb5840e28 Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 11 ++++ ansible/roles/prechecks/tasks/port_checks.yml | 50 ------------------- ansible/roles/swift/tasks/precheck.yml | 48 ++++++++++++++++++ 3 files changed, 59 insertions(+), 50 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index f67403262f..d72f1bdcd3 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -379,6 +379,17 @@ - "{{ 'senlin_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Swift Proxy Server HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ swift_proxy_server_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_swift | bool + - "{{ 'swift_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Tacker Server 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 a945766a47..52d4727003 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -172,53 +172,3 @@ when: - enable_solum | bool - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Swift Object Server - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" - port: "{{ swift_object_server_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_swift | bool - - inventory_hostname in groups['swift-object-server'] - -- name: Checking free port for Swift Account Server - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" - port: "{{ swift_account_server_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_swift | bool - - inventory_hostname in groups['swift-account-server'] - -- name: Checking free port for Swift Container Server - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" - port: "{{ swift_container_server_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_swift | bool - - inventory_hostname in groups['swift-container-server'] - -- name: Checking free port for Swift Proxy Server - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ swift_proxy_server_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_swift | bool - - inventory_hostname in groups['swift-proxy-server'] - -- name: Checking free port for Swift Proxy Server HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ swift_proxy_server_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_swift | bool - - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/swift/tasks/precheck.yml b/ansible/roles/swift/tasks/precheck.yml index ed97d539c0..2c0a649743 100644 --- a/ansible/roles/swift/tasks/precheck.yml +++ b/ansible/roles/swift/tasks/precheck.yml @@ -1 +1,49 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - swift_account_server + - swift_container_server + - swift_object_server + - swift_proxy_server + register: container_facts + +- name: Checking free port for Swift Account Server + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" + port: "{{ swift_account_server_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['swift_account_server'] is not defined + - inventory_hostname in groups['swift-account-server'] + +- name: Checking free port for Swift Container Server + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" + port: "{{ swift_container_server_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['swift_container_server'] is not defined + - inventory_hostname in groups['swift-container-server'] + +- name: Checking free port for Swift Object Server + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + storage_interface]['ipv4']['address'] }}" + port: "{{ swift_object_server_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['swift_object_server'] is not defined + - inventory_hostname in groups['swift-object-server'] + +- name: Checking free port for Swift Proxy Server + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ swift_proxy_server_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['swift_proxy_server'] is not defined + - inventory_hostname in groups['swift-proxy-server']