You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In versions of Consul prior to 0.4, bootstrapping was a more manual process. [...] Manual bootstrapping is not recommended as it is more error-prone than automatic bootstrapping with -bootstrap-expect.
The examples currently only show manual bootstrapping, and neglect to mention that the -bootstrap option is not safe to leave enabled once bootstrapping is complete. (They also show setting -bootstrap across all nodes, which is not correct.) It took some trial and error and reading of the module code to get automatic bootstrapping to work:
This example demonstrates using a public IP address for deployment via SSH, but configuring the Consul cluster to use private IP addresses (ansible_default_ipv4 returns private IP addresses). It also uses a non-root account for SSH (which requires applying a fix for #146, such as PR #159, for recent Ansible versions). Finally, setting consul_node_name, consul_servers, consul_join_at_start, and consul_retry_join are all necessary for consul_bootstrap_expect to work.
Update: Removed consul_join_at_start
The text was updated successfully, but these errors were encountered:
This is a good idea but a couple of points I would change.
First, ansible_default_ipv4 does not return "private addresses". It returns whichever IP is on the default route to 8.8.8.8.
If you want to be sure which interface is used, you need to specify it. I define a variable iface as a host variable, it would contain a value such as eth1. You can retrieve an IP for an interface from the variable ansible_eth1.ip4v.address. I use the following extractor in my playbook which will get the address from the specified interface for every host in my 'consul' group.
Another point - using consul_join_at_start along with consul_bootstrap_expect led to problems for me because the server would crash if the other members were not available at startup. Just set consul_retry_join: true and it will join the cluster at startup, retrying in case the other members haven't started yet.
https://www.consul.io/docs/guides/bootstrapping.html:
The examples currently only show manual bootstrapping, and neglect to mention that the
-bootstrap
option is not safe to leave enabled once bootstrapping is complete. (They also show setting-bootstrap
across all nodes, which is not correct.) It took some trial and error and reading of the module code to get automatic bootstrapping to work:This example demonstrates using a public IP address for deployment via SSH, but configuring the Consul cluster to use private IP addresses (
ansible_default_ipv4
returns private IP addresses). It also uses a non-root account for SSH (which requires applying a fix for #146, such as PR #159, for recent Ansible versions). Finally, settingconsul_node_name
,consul_servers
,consul_join_at_start
, andconsul_retry_join
are all necessary forconsul_bootstrap_expect
to work.Update: Removed
consul_join_at_start
The text was updated successfully, but these errors were encountered: