From a1addc35658b2f132ed8e783087016e5c8572f66 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Mon, 12 Aug 2019 18:14:49 +0100
Subject: [PATCH] Sort overcloud inventory hosts and groups

This provides a more predictable and stable ordering for the inventory
generated via 'kayobe overcloud inventory discover'.

TrivialFix

Change-Id: Ie784b7e91cd70ed5c552723789958e32724b17a8
---
 ansible/overcloud-inventory-discover.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ansible/overcloud-inventory-discover.yml b/ansible/overcloud-inventory-discover.yml
index 3ffc94156..2dc8e34c1 100644
--- a/ansible/overcloud-inventory-discover.yml
+++ b/ansible/overcloud-inventory-discover.yml
@@ -37,10 +37,10 @@
           {% set ignore_hosts = overcloud_group_hosts_map.get("ignore", []) %}
 
           {# Add a section for each group. #}
-          {% for group in overcloud_groups %}
+          {% for group in overcloud_groups | sort %}
           [{{ group }}]
           {% set group_hosts = overcloud_group_hosts_map.get(group, []) %}
-          {% for host in ironic_inventory.baremetal.hosts %}
+          {% for host in ironic_inventory.baremetal.hosts | sort %}
           {% if (host in group_hosts or
                  (group == overcloud_group_default and host not in all_mapped_hosts))
                 and host not in ignore_hosts %}