mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Digitalocean public private ip (#27269)
* When using private networking the ip_address key contains the private ip. Add the following info to module output when available: - private_ipv4_address - public_ipv4_address - private_ipv6_address - public_ipv6_address
This commit is contained in:
committed by
Abhijeet Kasurde
parent
c6f397b160
commit
4094ba7682
@@ -232,6 +232,12 @@ class Droplet(JsonfyMixIn):
|
||||
if attrs:
|
||||
for k, v in attrs.items():
|
||||
setattr(self, k, v)
|
||||
networks = attrs.get('networks', {})
|
||||
for network in networks.get('v6', []):
|
||||
if network['type'] == 'public':
|
||||
setattr(self, 'public_ipv6_address', network['ip_address'])
|
||||
else:
|
||||
setattr(self, 'private_ipv6_address', network['ip_address'])
|
||||
else:
|
||||
json = self.manager.show_droplet(self.id)
|
||||
if json['ip_address']:
|
||||
|
||||
Reference in New Issue
Block a user