mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #11299 from rncry/patch-2
support instances with no public ip
This commit is contained in:
commit
0c27315648
1 changed files with 2 additions and 2 deletions
|
@ -221,7 +221,7 @@ class GceInventory(object):
|
||||||
'gce_image': inst.image,
|
'gce_image': inst.image,
|
||||||
'gce_machine_type': inst.size,
|
'gce_machine_type': inst.size,
|
||||||
'gce_private_ip': inst.private_ips[0],
|
'gce_private_ip': inst.private_ips[0],
|
||||||
'gce_public_ip': inst.public_ips[0],
|
'gce_public_ip': inst.public_ips[0] if len(inst.public_ips) >= 1 else None,
|
||||||
'gce_name': inst.name,
|
'gce_name': inst.name,
|
||||||
'gce_description': inst.extra['description'],
|
'gce_description': inst.extra['description'],
|
||||||
'gce_status': inst.extra['status'],
|
'gce_status': inst.extra['status'],
|
||||||
|
@ -230,7 +230,7 @@ class GceInventory(object):
|
||||||
'gce_metadata': md,
|
'gce_metadata': md,
|
||||||
'gce_network': net,
|
'gce_network': net,
|
||||||
# Hosts don't have a public name, so we add an IP
|
# Hosts don't have a public name, so we add an IP
|
||||||
'ansible_ssh_host': inst.public_ips[0]
|
'ansible_ssh_host': inst.public_ips[0] if len(inst.public_ips) >= 1 else inst.private_ips[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_instance(self, instance_name):
|
def get_instance(self, instance_name):
|
||||||
|
|
Loading…
Reference in a new issue