From d8a744e436d339cea73b6bc1835edaff8e4399c3 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 29 Jun 2017 17:26:22 +0100
Subject: [PATCH] Allow empty compute group when ironic is in use

If ironic is in use it is valid to have no (virtualised) compute nodes.

Change-Id: I100540fbfd81be5642c1d4ed135fcd500924a47e
Closes-Bug: #1701317
---
 ansible/roles/nova/tasks/precheck.yml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/nova/tasks/precheck.yml b/ansible/roles/nova/tasks/precheck.yml
index 22af7ea465..0bb74e4a8a 100644
--- a/ansible/roles/nova/tasks/precheck.yml
+++ b/ansible/roles/nova/tasks/precheck.yml
@@ -12,9 +12,14 @@
   register: container_facts
 
 - name: Checking available compute nodes in inventory
+  vars:
+    nova_compute_ironic: "{{ nova_services['nova-compute-ironic'] }}"
   fail:
-    msg: "At least 1 compute node required in inventory"
-  when: groups['compute'] | length < 1
+    msg: >
+      At least 1 compute node required in inventory when ironic is disabled.
+  when:
+    - groups['compute'] | length < 1
+    - not nova_compute_ironic.enabled | bool
 
 - name: Checking free port for Nova API
   vars: