diff --git a/ansible/roles/gnocchi/tasks/precheck.yml b/ansible/roles/gnocchi/tasks/precheck.yml
index ed97d539c0..2a3f65770b 100644
--- a/ansible/roles/gnocchi/tasks/precheck.yml
+++ b/ansible/roles/gnocchi/tasks/precheck.yml
@@ -1 +1,16 @@
 ---
+- name: Get container facts
+  kolla_container_facts:
+    name:
+      - gnocchi_api
+  register: container_facts
+
+- name: Checking free port for Gnocchi API
+  wait_for:
+    host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
+    port: "{{ gnocchi_api_port }}"
+    connect_timeout: 1
+    state: stopped
+  when:
+    - container_facts['gnocchi_api'] is not defined
+    - inventory_hostname in groups['gnocchi-api']
diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml
index 8e7caa4925..44b1f03777 100644
--- a/ansible/roles/haproxy/tasks/precheck.yml
+++ b/ansible/roles/haproxy/tasks/precheck.yml
@@ -113,6 +113,17 @@
     - inventory_hostname in groups['haproxy']
     - "{{ 'glance_registry' not in haproxy_stat }}"
 
+- name: Checking free port for Gnocchi API HAProxy
+  wait_for:
+    host: "{{ kolla_internal_vip_address }}"
+    port: "{{ gnocchi_api_port }}"
+    connect_timeout: 1
+    state: stopped
+  when:
+    - enable_gnocchi | bool
+    - "{{ 'gnocchi_api' not in haproxy_stat }}"
+    - inventory_hostname in groups['haproxy']
+
 - name: Checking free port for Heat API 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 c4951cb2e0..9d75af8bb3 100644
--- a/ansible/roles/prechecks/tasks/port_checks.yml
+++ b/ansible/roles/prechecks/tasks/port_checks.yml
@@ -53,26 +53,6 @@
     - enable_etcd | bool
     - inventory_hostname in groups['etcd']
 
-- name: Checking free port for Gnocchi API
-  wait_for:
-    host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
-    port: "{{ gnocchi_api_port }}"
-    connect_timeout: 1
-    state: stopped
-  when:
-    - enable_gnocchi | bool
-    - inventory_hostname in groups['gnocchi-api']
-
-- name: Checking free port for Gnocchi API HAProxy
-  wait_for:
-    host: "{{ kolla_internal_vip_address }}"
-    port: "{{ gnocchi_api_port }}"
-    connect_timeout: 1
-    state: stopped
-  when:
-    - enable_gnocchi | bool
-    - inventory_hostname in groups['haproxy']
-
 - name: Checking free port for Kuryr
   wait_for:
     host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"