mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #9336 from dpkirchner/devel
Added _meta hostvars key to gce.py plugin
This commit is contained in:
commit
e8f675003f
1 changed files with 8 additions and 0 deletions
|
@ -233,9 +233,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]
|
||||
|
@ -263,6 +268,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):
|
||||
|
|
Loading…
Reference in a new issue