2022-07-28 14:14:26 +00:00
|
|
|
- block:
|
|
|
|
- name: Set var for cluster nodes list
|
|
|
|
set_fact:
|
|
|
|
cluster_node_list: []
|
|
|
|
|
|
|
|
- name: Get cluster nodes
|
|
|
|
command: curl http://127.0.0.1:8500/v1/status/peers
|
|
|
|
environment:
|
|
|
|
no_proxy: 127.0.0.1
|
|
|
|
register: cluster_nodes
|
|
|
|
changed_when: false
|
|
|
|
no_log: true
|
|
|
|
|
|
|
|
- name: Print cluster nodes
|
|
|
|
debug:
|
|
|
|
msg: "{{ cluster_nodes.stdout }}"
|
2023-01-12 15:52:45 +00:00
|
|
|
verbosity: 2
|
2022-07-28 14:14:26 +00:00
|
|
|
|
|
|
|
- name: Print cluster nodes
|
|
|
|
debug:
|
|
|
|
msg: "{{ item }}"
|
2023-01-12 15:52:45 +00:00
|
|
|
verbosity: 2
|
2022-07-28 14:14:26 +00:00
|
|
|
loop: "{{ cluster_nodes.stdout | from_json }}"
|
|
|
|
|
|
|
|
- name: Merge cluster nodes list
|
|
|
|
set_fact:
|
|
|
|
cluster_node_list: "{{ cluster_node_list + [item|split(':')|first] }}"
|
|
|
|
loop: "{{ cluster_nodes.stdout | from_json }}"
|
|
|
|
|
|
|
|
- name: Print cluster nodes list
|
|
|
|
debug:
|
|
|
|
msg: "{{ cluster_node_list }}"
|
2023-01-12 15:52:45 +00:00
|
|
|
verbosity: 2
|
2022-07-28 14:14:26 +00:00
|
|
|
|
|
|
|
run_once: true
|
|
|
|
ignore_errors: yes
|