sous-chefs / consul

Development repository for the consul cookbook
https://supermarket.chef.io/cookbooks/consul
Apache License 2.0
192 stars 244 forks source link

Bind consul to a specific IP #391

Closed raju-divakaran closed 7 years ago

raju-divakaran commented 7 years ago

Hello,

Recently we enabled docker-engine on a server where we are having consul agent also running. Soon after starting docker-engine, as we know the docker0 ( default bridge n/w ) is enabled. This results in consul not getting started, as it complains there are multiple internal IPs.

Can we please incorporate a way to bind consul agent to an IP if needed by including that option in the systemd file.

Thanks

legal90 commented 7 years ago

Hi @raju-divakaran You can set any consul configuration option by overriding the attribute, for example in a wrapper recipe:

node.override['consul']['config'][OPT_NAME] = OPT_VALUE

In particular, for bind_addr it will be:

node.override['consul']['config']['bind_addr'] = '10.10.20.30'

Being passed to consul_config resource, these options will be rendered in /etc/consul/consul.json and parsed by the consul daemon after the service restart. https://github.com/johnbellone/consul-cookbook/blob/3e123c2706250a9589874c8d01824eeeab090f0a/recipes/default.rb#L43

legal90 commented 7 years ago

I hope my comment above helps. Closing this issue.

raju-divakaran commented 7 years ago

Yes, I don't know how I missed that option. Thanks much!

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.