mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07: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:
parent
c6f397b160
commit
4094ba7682
1 changed files with 6 additions and 0 deletions
|
@ -232,6 +232,12 @@ class Droplet(JsonfyMixIn):
|
||||||
if attrs:
|
if attrs:
|
||||||
for k, v in attrs.items():
|
for k, v in attrs.items():
|
||||||
setattr(self, k, v)
|
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:
|
else:
|
||||||
json = self.manager.show_droplet(self.id)
|
json = self.manager.show_droplet(self.id)
|
||||||
if json['ip_address']:
|
if json['ip_address']:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue