From f1f12d70a3b21ebf4733389107f31c9487a74102 Mon Sep 17 00:00:00 2001
From: Yang Youseok <ileixe@gmail.com>
Date: Wed, 11 Sep 2019 14:06:36 +0900
Subject: [PATCH] Ignore create_cells and discover_computes when nova-api is
 disabled

When nova-api group have no hosts, we don't have to run create_cells
and discover_computes. Add conditional blocks to prevent to run them.

Change-Id: Ia1ba058c1b74b06b678f45544883e567e2b4eb55
Closes-Bug: #1843235
---
 ansible/roles/nova/tasks/deploy.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ansible/roles/nova/tasks/deploy.yml b/ansible/roles/nova/tasks/deploy.yml
index 5a39897135..d92d0a882b 100644
--- a/ansible/roles/nova/tasks/deploy.yml
+++ b/ansible/roles/nova/tasks/deploy.yml
@@ -22,8 +22,10 @@
         inventory_hostname in groups['compute']
 
 - include_tasks: create_cells.yml
+  when: inventory_hostname in groups['nova-api']
 
 - name: Flush handlers
   meta: flush_handlers
 
 - include_tasks: discover_computes.yml
+  when: inventory_hostname in groups['nova-api']