infra-role-geth/tasks/consul.yml

81 lines
3.1 KiB
YAML

---
- name: Geth | Consul | Create service definition
include_role: name=infra-role-consul-service
vars:
consul_config_name: '{{ geth_cont_name }}'
consul_services:
- id: '{{ geth_cont_name }}'
name: '{{ geth_consul_service_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 }}'
version: '{{ geth_cont_tag | regex_replace("^v", "") }}'
checks:
- id: '{{ geth_cont_name }}-status'
type: tcp
tcp: '127.0.0.1:{{ geth_port }}'
- id: '{{ geth_cont_name }}-metrics'
name: '{{ geth_consul_service_name }}-metrics'
tags: '{{ geth_consul_tags + ["metrics"] }}'
port: '{{ geth_metrics_port }}'
address: '{{ geth_consul_advertised_address }}'
disabled: '{{ not geth_metrics_enabled }}'
checks:
- id: '{{ geth_cont_name }}-metrics-status'
type: 'tcp'
tcp: 'localhost:{{ geth_metrics_port }}'
timeout: '5s'
failures_before_critical: 3
- id: '{{ geth_cont_name }}-rpc'
name: '{{ geth_consul_service_name }}-rpc'
tags: '{{ geth_consul_tags + ["rpc"] }}'
port: '{{ geth_rpc_port }}'
address: '{{ geth_consul_advertised_address }}'
disabled: '{{ not geth_rpc_enabled }}'
meta:
url: 'http://{{ geth_consul_advertised_address }}:{{ geth_rpc_port }}'
version: '{{ geth_cont_tag | regex_replace("^v", "") }}'
checks:
- id: '{{ geth_cont_name }}-rpc-status'
type: 'script'
script: '{{ geth_rpc_wrapper }} eth_syncing'
timeout: '5s'
failures_before_critical: 3
- id: '{{ geth_cont_name }}-authrpc'
name: '{{ geth_consul_service_name }}-authrpc'
tags: '{{ geth_consul_tags + ["authrpc", "engine"] }}'
port: '{{ geth_authrpc_port }}'
address: '{{ geth_consul_advertised_address }}'
disabled: '{{ not geth_authrpc_enabled }}'
meta:
url: 'http://{{ geth_consul_advertised_address }}:{{ geth_authrpc_port }}'
version: '{{ geth_cont_tag | regex_replace("^v", "") }}'
checks:
- id: '{{ geth_cont_name }}-authrpc-status'
type: 'tcp'
tcp: 'localhost:{{ geth_authrpc_port }}'
failures_before_critical: 3
- id: '{{ geth_cont_name }}-ws'
name: '{{ geth_consul_service_name }}-ws'
tags: '{{ geth_consul_tags + ["websocket"] }}'
port: '{{ geth_websocket_port }}'
address: '{{ geth_consul_advertised_address }}'
disabled: '{{ not geth_websocket_enabled }}'
meta:
url: 'ws://{{ geth_consul_advertised_address }}:{{ geth_websocket_port }}'
version: '{{ geth_cont_tag | regex_replace("^v", "") }}'
checks:
- id: '{{ geth_cont_name }}-ws-status'
name: 'Geth WebSocket API'
type: 'tcp'
tcp: 'localhost:{{ geth_websocket_port }}'
failures_before_critical: 3