infra-role-nimbus-fluffy/tasks/consul.yml

47 lines
1.6 KiB
YAML

---
- name: Query node ENR address
uri:
url: 'http://localhost:{{ nimbus_fluffy_rpc_port }}/'
method: 'POST'
body_format: 'json'
body:
id: 1
jsonrpc: '2.0'
method: 'discv5_nodeInfo'
params: []
register: node_info_raw
- name: Extract node ENR address
set_fact:
nimbus_fluffy_node_enr: '{{ node_info_raw.json.result.nodeENR }}'
- name: 'Create Consul service definition'
include_role: name=consul-service
vars:
consul_config_name: '{{ nimbus_fluffy_consul_service_file_name }}'
consul_services:
- id: '{{ nimbus_fluffy_service_name }}'
name: '{{ nimbus_fluffy_consul_service_name }}'
port: '{{ nimbus_fluffy_listening_port }}'
address: '{{ nimbus_fluffy_public_address }}'
tags: ['{{ env }}.{{ stage }}', 'eth1', 'nimbus']
meta:
node_enr: '{{ nimbus_fluffy_node_enr }}'
checks:
- name: '{{ nimbus_fluffy_consul_service_name }}-health'
type: 'script'
script: '{{ nimbus_fluffy_rpc_script_path }} discv5_nodeInfo'
timeout: '5s'
- id: '{{ nimbus_fluffy_service_name }}-metrics'
name: '{{ nimbus_fluffy_consul_metrics_service_name }}'
port: '{{ nimbus_fluffy_metrics_port }}'
address: '{{ ansible_local.wireguard.vpn_ip }}'
tags: ['{{ env }}.{{ stage }}', 'eth1', 'nimbus', 'metrics']
meta:
container: '{{ nimbus_fluffy_service_name }}'
checks:
- name: '{{ nimbus_fluffy_consul_metrics_service_name }}-health'
type: 'http'
http: 'http://localhost:{{ nimbus_fluffy_metrics_port }}/health'