On Scaleway, public IP is not attached to network interface. Scaleway support replied:
In order to offer flexible IPs and reassign one to a different instance, the public IP is translated from the private IP and doesn’t appear on the machine itself. Other providers may have a different method of doing it.
Ansible: Get host public IP on a Scaleway server
In ansible use: {{ ansible_ssh_host }}
Galera cluster
One consequence of this Scaleway behavior, is for a server to join a Galera cluster, we need to bind on the private IP using the ist.recv_bind
option:
# Galera Node Configuration
wsrep_node_name="{{ ansible_hostname }}"# will be replaced by public IP
wsrep_node_address="{{ ansible_ssh_host }}"# scaleway: can not listen on pub because it is not bound to interface. Will be replaced by private IP
wsrep_provider_options="ist.recv_bind={{ ansible_all_ipv4_addresses | ipaddr('private') | first }}"