2020-12-07 11:20:33 +00:00
|
|
|
---
|
|
|
|
- name: Get data centers
|
|
|
|
uri:
|
|
|
|
url: '{{ consul_catalog_url }}/datacenters'
|
|
|
|
register: data_centers
|
|
|
|
|
|
|
|
- name: Get AlertManager node addresses
|
|
|
|
uri:
|
2020-12-07 12:11:09 +00:00
|
|
|
url: '{{ consul_catalog_url }}/service/{{ alertmanager_service_name }}?dc={{ item }}'
|
2020-12-07 11:20:33 +00:00
|
|
|
method: GET
|
|
|
|
validate_certs: no
|
|
|
|
with_items: '{{ data_centers.json }}'
|
|
|
|
register: alertmanager_services
|
|
|
|
|
|
|
|
- name: Extract IP addresses
|
|
|
|
set_fact:
|
2020-12-07 12:11:09 +00:00
|
|
|
alertmanager_cluster_peers: |
|
2020-12-07 11:20:33 +00:00
|
|
|
{{ alertmanager_services.results
|
|
|
|
| sum(attribute="json", start=[])
|
2020-12-07 12:11:09 +00:00
|
|
|
| sort(attribute='Node')
|
2020-12-07 11:20:33 +00:00
|
|
|
| list }}
|