diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 0d5972e777..79d768cd01 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -101,3 +101,14 @@ - enable_manila | bool - "{{ 'manila_api' not in haproxy_stat }}" - inventory_hostname in groups['haproxy'] + +- name: Checking free port for Sahara API HAProxy + wait_for: + host: "{{ kolla_internal_vip_address }}" + port: "{{ sahara_api_port }}" + connect_timeout: 1 + state: stopped + when: + - enable_sahara | bool + - "{{ 'sahara_api' not in haproxy_stat }}" + - inventory_hostname in groups['haproxy'] diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index b2427d8869..6ee3182933 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -163,26 +163,6 @@ - enable_kuryr | bool - inventory_hostname in groups['compute'] -- name: Checking free port for Sahara API - wait_for: - host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ sahara_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_sahara | bool - - inventory_hostname in groups['sahara-api'] - -- name: Checking free port for Sahara API HAProxy - wait_for: - host: "{{ kolla_internal_vip_address }}" - port: "{{ sahara_api_port }}" - connect_timeout: 1 - state: stopped - when: - - enable_sahara | bool - - inventory_hostname in groups['haproxy'] - - name: Checking free port for HAProxy stats wait_for: host: "{{ kolla_internal_vip_address }}" diff --git a/ansible/roles/sahara/tasks/precheck.yml b/ansible/roles/sahara/tasks/precheck.yml index ed97d539c0..918d3c513d 100644 --- a/ansible/roles/sahara/tasks/precheck.yml +++ b/ansible/roles/sahara/tasks/precheck.yml @@ -1 +1,16 @@ --- +- name: Get container facts + kolla_container_facts: + name: + - sahara_api + register: container_facts + +- name: Checking free port for Sahara API + wait_for: + host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" + port: "{{ sahara_api_port }}" + connect_timeout: 1 + state: stopped + when: + - container_facts['sahara_api'] is not defined + - inventory_hostname in groups['sahara-api']