infra-role-geth/tasks/consul.yml

44 lines
1.5 KiB
YAML

---
- name: Geth | Create Consul service definition
include_role: name=consul-service
vars:
consul_config_name: '{{ geth_cont_name }}'
consul_services:
- name: '{{ geth_cont_name }}'
tags: '{{ geth_consul_tags }}'
port: '{{ geth_port }}'
address: '{{ ansible_host }}'
meta:
node_addr: '{{ node_info.json.result.id }}'
node_enode: '{{ node_info.json.result.enode }}'
checks:
- id: '{{ geth_cont_name }}-status'
type: tcp
tcp: '127.0.0.1:{{ geth_port }}'
- name: '{{ geth_cont_name }}-rpc'
tags: '{{ geth_consul_tags + ["rpc"] }}'
port: '{{ geth_rpc_port }}'
address: '{{ ansible_local.wireguard.address }}'
meta:
url: 'http://{{ ansible_local.wireguard.address }}:{{ geth_rpc_port }}'
checks:
- id: '{{ geth_cont_name }}-rpc-status'
type: 'script'
script: '{{ geth_rpc_wrapper }} eth_syncing'
timeout: '5s'
failures_before_critical: 3
- name: '{{ geth_cont_name }}-ws'
tags: '{{ geth_consul_tags + ["websocket"] }}'
port: '{{ geth_websocket_port }}'
address: '{{ ansible_local.wireguard.address }}'
meta:
url: 'ws://{{ ansible_local.wireguard.address }}:{{ geth_websocket_port }}'
checks:
- id: '{{ geth_cont_name }}-ws-status'
name: 'Geth WebSocket API'
type: 'tcp'
tcp: 'localhost:{{ geth_websocket_port }}'
failures_before_critical: 3