UpCloudLtd/upcloud-ansible-collection

No fallback if server has no public ipv4

HOSTED-POWER opened this issue · 2 comments

Hi,

When we try to get all the servers in upcloud the default is to throw an exception if a server has no public interface at all.

This is quite unfortunate, it's very well possible there are a couple of 100 servers and only a few have no public ipv4 interface. This should not throw a fatal error but just leave the host empty.

An even better alternative is trying to fallback to the private ip address... Since it's most likely the best option when no public ipv4 is found. At least it's nice to have the private address which can possible used over a VPN or an ssh tunnel.

I implemented such change here: https://github.com/HOSTED-POWER/upcloud-ansible-collection/blob/main/plugins/inventory/upcloud.py

I think it's really needed, the current design breaks completely as soon as one host has no public ipv4 address.

Hi,
Experiencing the same issue. I have only one edge server with public IPv4, all the rest have private network assigned (I'm using VPN for connection). When I try to get inventory it's becoming stuck on first server without public IP, so I can't even see all the rest servers (even using option --host). Please fix this, as it's unexpected behavior and for sure is not correct. Private IP should be shown in the list the same way as public IP (as well as the labels).
Give us at least some feedback if you have another vision.

Hi there @HOSTED-POWER and @kidmis,

There is now a new version of the Ansible inventory plugin out where servers that do not match the expected connection type are skipped, so you should no longer experience errors with these. Previously the behaviour was tied to having the expected connect_with attribute that failed if any matching server did not have that (public IPv4 is the default in this). You can see examples on how this can be configured with a possibility to connect via public networking (public_ipv4 (default) or public_ipv6), via our Utility overlay network (utility_ipv4) or via a private network (private_ipv4) where one also needs to provide the wanted network. This should hopefully make using the inventory easier in the future.

New release also contains other new filtering options (such as filtering by server labels or by server group). Please take a look and report back if you encounter any issues. I will be keeping this issue open for a while, so you can get back if you are still experiencing issues with this.

Sorry for the wait!