From 2b7bde0a7b40edf27c35828b6eab7654b1b1838a Mon Sep 17 00:00:00 2001 From: caoyuan Date: Mon, 9 Jan 2017 10:39:48 +0800 Subject: [PATCH] Move keystone precheck into its own role Change-Id: I5290c923530338682808205cc9c3957178de469c Partially-implements: blueprint condition-pre-check --- ansible/roles/haproxy/tasks/precheck.yml | 33 +++++++++++++++ ansible/roles/keystone/tasks/precheck.yml | 25 ++++++++++++ ansible/roles/prechecks/tasks/port_checks.yml | 40 ------------------- 3 files changed, 58 insertions(+), 40 deletions(-) diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index f84d605fc4..3e8774a453 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -179,6 +179,39 @@ - "{{ 'ironic_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] +- name: Checking free port for Keystone Admin HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ keystone_admin_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_keystone | bool + - "{{ 'keystone_admin' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Keystone Internal HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ keystone_public_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_keystone | bool + - "{{ 'keystone_internal' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Keystone Public HAProxy + wait_for: + host: "{{ kolla_external_vip_address }}" + port: "{{ keystone_public_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_keystone | bool + - "{{ 'keystone_external' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] + - name: Checking free port for Kibana HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/keystone/tasks/precheck.yml b/ansible/roles/keystone/tasks/precheck.yml index ed97d539c0..7b653a3ead 100644 --- a/ansible/roles/keystone/tasks/precheck.yml +++ b/ansible/roles/keystone/tasks/precheck.yml @@ -1 +1,26 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - keystone + register: container_facts + +- name: Checking free port for Keystone Admin + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ keystone_admin_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['keystone'] is not defined + - inventory_hostname in groups['keystone'] + +- name: Checking free port for Keystone Public + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ keystone_public_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['keystone'] is not defined + - inventory_hostname in groups['keystone'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index e4ab701a1d..60ffc29d61 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -43,46 +43,6 @@ - enable_haproxy | bool - inventory_hostname in groups['haproxy'] -- name: Checking free port for Keystone Admin - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ keystone_admin_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_keystone | bool - - inventory_hostname in groups['keystone'] - -- name: Checking free port for Keystone Admin HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ keystone_admin_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_keystone | bool - - inventory_hostname in groups['haproxy'] - -- name: Checking free port for Keystone Public - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ keystone_public_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_keystone | bool - - inventory_hostname in groups['keystone'] - -- name: Checking free port for Keystone Public HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ keystone_public_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_keystone | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for iscsi wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"