I am trying to install consul on one of my servers (I have ten others already) via ansible using the Consul Ansible role, but I get the following error:
TASK [idealista.consul-role : Consul | Create ACL] ***************************************************************************************
failed: [php7d] (item={'key': 'Agent', 'value': {'token_type': 'client', 'token': 'xxxxxxxxxxx', 'rules': [{'node': '', 'policy': 'write'}, {'service': '', 'policy': 'read'}]}}) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "Agent", "value": {"rules": [{"node": "", "policy": "write"}, {"policy": "read", "service": ""}], "token": "xxxxxxxxxxx", "token_type": "client"}}, "msg": "Could not connect to consul agent at xxx.xx.x.xx:xxxx, error was HTTPConnectionPool(host='xx.xx.x.x', port=8500): Max retries exceeded with url: /v1/acl/list?token=******** (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcb7ead26d0>: Failed to establish a new connection: [Errno 110] Connection timed out',))"}
I went ahead and compared the consul.json file to one of my other servers and everything matches outside of the new IP.
{
"node_name": "php7d",
"ui": true,
"addresses":{
"http": "0.0.0.0"
},
"data_dir": "/opt/consul/data",
"log_level": "INFO",
"domain": "consul",
"datacenter": "xxxxx",
"bind_addr": "xxx.xx.x.xx",
"advertise_addr": "xxx.xx.x.xx",
"ports": {
"http": 8500,
"dns": 8600
},
"server": false,
"enable_syslog": false,
"retry_join": ["xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx"],
"rejoin_after_leave": true,
"start_join": ["xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx", "xxx.xx.x.xx"]
}
Since it is failing setting up via ansible, I tried to run the following manually consul agent -config-dir=/opt/consul/consul.d
but I go this back:
==> Starting Consul agent...
==> Error starting agent: Failed to start Consul client: Failed to start lan serf: Failed to create memberlist: Could not set up network transport: failed to obtain an address: Failed to start TCP listener on "xx.xxx.xxx.xxx" port xxxx: listen tcp xx.xxx.xxx.xxx:xxxx: bind: address already in use
Would anyone have any recommendations on how to fix this?