diff --git a/tasks/consul.yml b/tasks/consul.yml index 3643ceb..f7e3601 100644 --- a/tasks/consul.yml +++ b/tasks/consul.yml @@ -1,8 +1,6 @@ --- -- name: Geth | Create Consul service definition - include_role: name=consul-service - vars: - consul_config_name: '{{ geth_cont_name }}' +- name: Geth | Consul | Define services + set_fact: consul_services: - name: '{{ geth_cont_name }}' tags: '{{ geth_consul_tags }}' @@ -41,3 +39,14 @@ type: 'tcp' tcp: 'localhost:{{ geth_websocket_port }}' failures_before_critical: 3 + +- name: Geth | Consul | Remove WebSocket service + set_fact: + consul_services: | + {{ consul_services | rejectattr('name', 'match', '.*-ws$') | list }} + when: not geth_websocket_enabled + +- name: Geth | Consul | Create service definition + include_role: name=consul-service + vars: + consul_config_name: '{{ geth_cont_name }}'