diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml
index 13662a2818..89290b0169 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 101f73f3d0..cd37a93818 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'] }}"