From 959520115cb5e806de2f4c929f04c87d683f4e7a Mon Sep 17 00:00:00 2001 From: David Kirchner Date: Tue, 14 Oct 2014 14:43:28 +0000 Subject: [PATCH] Added _meta hostvars key to gce.py plugin per the discussion in issue #9291. --- plugins/inventory/gce.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/inventory/gce.py b/plugins/inventory/gce.py index c8eeb43ab1b..9bb8d84065b 100755 --- a/plugins/inventory/gce.py +++ b/plugins/inventory/gce.py @@ -229,9 +229,14 @@ class GceInventory(object): def group_instances(self): '''Group all instances''' groups = {} + meta = {} + meta["hostvars"] = {} + for node in self.driver.list_nodes(): name = node.name + meta["hostvars"][name] = self.node_to_dict(node) + zone = node.extra['zone'].name if groups.has_key(zone): groups[zone].append(name) else: groups[zone] = [name] @@ -259,6 +264,9 @@ class GceInventory(object): stat = 'status_%s' % status.lower() if groups.has_key(stat): groups[stat].append(name) else: groups[stat] = [name] + + groups["_meta"] = meta + return groups def json_format_dict(self, data, pretty=False):