summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter_plugins/oo_filters.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index cf141d4f8..2386b5878 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -433,13 +433,16 @@ class FilterModule(object):
def _add_host(clusters,
env,
host_type,
+ sub_host_type,
host):
''' Add a new host in the clusters data structure '''
if env not in clusters:
clusters[env] = {}
if host_type not in clusters[env]:
- clusters[env][host_type] = []
- clusters[env][host_type].append(host)
+ clusters[env][host_type] = {}
+ if sub_host_type not in clusters[env][host_type]:
+ clusters[env][host_type][sub_host_type] = []
+ clusters[env][host_type][sub_host_type].append(host)
clusters = {}
for host in data:
@@ -447,10 +450,10 @@ class FilterModule(object):
_add_host(clusters=clusters,
env=_get_tag_value(host['group_names'], 'env'),
host_type=_get_tag_value(host['group_names'], 'host-type'),
+ sub_host_type=_get_tag_value(host['group_names'], 'sub-host-type'),
host={'name': host['inventory_hostname'],
'public IP': host['ansible_ssh_host'],
- 'private IP': host['ansible_default_ipv4']['address'],
- 'subtype': _get_tag_value(host['group_names'], 'sub-host-type')})
+ 'private IP': host['ansible_default_ipv4']['address']})
except KeyError:
pass
return clusters