mattfinlayson / ansible-consul

Ansible role for consul
Apache License 2.0
233 stars 181 forks source link

Problem with bind_addr if private network binds to eth1 interface #103

Open Suvitruf opened 8 years ago

Suvitruf commented 8 years ago

When I'm trying to create consul cluster on Soft Layer, it works fine 'cause private network binds to eth0.

But, for example, at Diagital Ocean private network binds to eth1 interface.

So, I see something like 10.12.0.9 in address when using consul members.

Mb change bind_addr declaration in consul.json.j2 to: "bind_addr": {% for host in consul_servers %}{% if host in ansible_all_ipv4_addresses %}"{{host}}"{% endif %}{% endfor %},?

lhoss commented 7 years ago

we also had issues because of the hardcoded eth0 logic in both initd/upstart init scripts (in our case actually it works on all hosts that do not have an eth0 .. and the ones that have, it's not THE expected interface , and bam, consul agent listens on a non-sense, non-configured iface)

the proper fix for this is to make a variable like consul_bind_iface to be used instead of all 'eth0' occurrences ...