UpCloudLtd / upcloud-ansible

Dynamic inventory and modules for managing servers via UpCloud's API
50 stars 17 forks source link

Better handling of IPv6 addresses #3

Closed elnygren closed 3 years ago

elnygren commented 8 years ago

Currently the upcloud module that is used to create/destroy servers populates an attribute called public_ip that prefers IPv4 due to https://github.com/UpCloudLtd/upcloud-python-api/issues/13. A better option would be to populate public_ipv4 and public_ipv6 attributes.

In addition, the same problem is inherent in the inventory script. Perhaps the .ini file could be used to control whether to use IPv4 or IPv6 (or which would be preferred as both are not guaranteed to exist).

elnygren commented 8 years ago

support added for this added in upcloud_api

https://github.com/UpCloudLtd/upcloud-python-api/blob/0.3.4-devel/upcloud_api/server.py#L377

implementation could be something along the lines of:

public_ipv4 = server.get_public_ip(addr_family='IPv4', strict=True)
public_ipv6 = server.get_public_ip(addr_family='IPv6', strict=True)
PopoSensei commented 3 years ago

Hello. We have fixed this issue in https://github.com/UpCloudLtd/upcloud-ansible/pull/33 Thank you for posting the issue.