consul: make optional services actually optional

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-03-24 13:13:33 +01:00
parent 293ebe5505
commit a41900b07a
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 7 additions and 12 deletions

View File

@ -1,6 +1,8 @@
--- ---
- name: Geth | Consul | Define services - name: Geth | Consul | Create service definition
set_fact: include_role: name=consul-service
vars:
consul_config_name: '{{ geth_cont_name }}'
consul_services: consul_services:
- id: '{{ geth_cont_name }}' - id: '{{ geth_cont_name }}'
name: '{{ geth_consul_service_name }}' name: '{{ geth_consul_service_name }}'
@ -20,6 +22,7 @@
tags: '{{ geth_consul_tags + ["rpc"] }}' tags: '{{ geth_consul_tags + ["rpc"] }}'
port: '{{ geth_rpc_port }}' port: '{{ geth_rpc_port }}'
address: '{{ ansible_local.wireguard.address }}' address: '{{ ansible_local.wireguard.address }}'
disabled: '{{ not geth_rpc_enabled }}'
meta: meta:
url: 'http://{{ ansible_local.wireguard.address }}:{{ geth_rpc_port }}' url: 'http://{{ ansible_local.wireguard.address }}:{{ geth_rpc_port }}'
checks: checks:
@ -34,6 +37,7 @@
tags: '{{ geth_consul_tags + ["authrpc", "engine"] }}' tags: '{{ geth_consul_tags + ["authrpc", "engine"] }}'
port: '{{ geth_authrpc_port }}' port: '{{ geth_authrpc_port }}'
address: '{{ ansible_local.wireguard.address }}' address: '{{ ansible_local.wireguard.address }}'
disabled: '{{ not geth_authrpc_enabled }}'
meta: meta:
url: 'http://{{ ansible_local.wireguard.address }}:{{ geth_authrpc_port }}' url: 'http://{{ ansible_local.wireguard.address }}:{{ geth_authrpc_port }}'
checks: checks:
@ -47,6 +51,7 @@
tags: '{{ geth_consul_tags + ["websocket"] }}' tags: '{{ geth_consul_tags + ["websocket"] }}'
port: '{{ geth_websocket_port }}' port: '{{ geth_websocket_port }}'
address: '{{ ansible_local.wireguard.address }}' address: '{{ ansible_local.wireguard.address }}'
disabled: '{{ not geth_websocket_enabled }}'
meta: meta:
url: 'ws://{{ ansible_local.wireguard.address }}:{{ geth_websocket_port }}' url: 'ws://{{ ansible_local.wireguard.address }}:{{ geth_websocket_port }}'
checks: checks:
@ -56,13 +61,3 @@
tcp: 'localhost:{{ geth_websocket_port }}' tcp: 'localhost:{{ geth_websocket_port }}'
failures_before_critical: 3 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 }}'