2021-10-12 11:52:13 +00:00
|
|
|
---
|
|
|
|
- name: Find available data centers
|
|
|
|
uri:
|
|
|
|
url: '{{ consul_catalog_url }}/datacenters'
|
|
|
|
register: data_centers
|
|
|
|
|
2021-12-03 18:40:52 +00:00
|
|
|
- name: Find available Geth API RPC services
|
2021-10-12 11:52:13 +00:00
|
|
|
uri:
|
2022-06-03 10:01:44 +00:00
|
|
|
url: '{{ consul_catalog_url }}/service/{{ service_name }}-rpc?dc={{ item }}'
|
2021-12-03 18:40:52 +00:00
|
|
|
with_items: '{{ data_centers.json }}'
|
|
|
|
register: geth_rpc_services
|
|
|
|
|
|
|
|
- name: Find available Geth API WebSocket services
|
|
|
|
uri:
|
2022-06-03 10:01:44 +00:00
|
|
|
url: '{{ consul_catalog_url }}/service/{{ service_name }}-ws?dc={{ item }}'
|
2021-10-12 11:52:13 +00:00
|
|
|
with_items: '{{ data_centers.json }}'
|
|
|
|
register: geth_ws_services
|
2022-06-03 10:01:44 +00:00
|
|
|
|
|
|
|
# On Windows json attribute is missing when it's [].
|
|
|
|
- name: Extract Geth websocket IP and port
|
|
|
|
set_fact:
|
|
|
|
geth_api_addresses: |
|
|
|
|
{{ geth_api_addresses +
|
|
|
|
(geth_rpc_services.results
|
|
|
|
+ geth_ws_services.results)
|
|
|
|
| sum(attribute="json", start=[])
|
|
|
|
| map(attribute='ServiceMeta.url')
|
|
|
|
| list }}
|