Arthur Koziel 04648b6465
Scan all DC's for Geth nodes (#57)
Signed-off-by: Arthur Koziel <arthur@arthurkoziel.com>
2021-05-19 17:54:46 +08:00

26 lines
788 B
YAML

---
- name: Find available data centers
uri:
url: '{{ consul_catalog_url }}/datacenters'
register: data_centers
- name: Find available geth websocket services
uri:
url: '{{ consul_catalog_url }}/service/{{ web3_geth_node_consul_name }}?dc={{ item }}'
with_items: '{{ data_centers.json }}'
register: geth_ws_services
- name: Extract Geth websocket IP and port
set_fact:
geth_ws_addresses: |
{{ geth_ws_services.results
| sum(attribute="json", start=[])
| json_query("[].[ServiceAddress, ServicePort]")
| map('join', ':')
| list }}
- name: Extract Goerli Geth WebSocket URL
set_fact:
# our nodes first (will be used by default) then an infura node
beacon_node_web3_urls: "{{ geth_ws_addresses + [ selected_infura_url ] }}"