45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
---
|
|
# ansible/tasks/rqlite/validate-cluster.yml
|
|
- name: Wait for all nodes to be up
|
|
uri:
|
|
url: "http://{{ hostvars[item]['ansible_host'] }}:{{ rqlite_http_port }}/readyz"
|
|
return_content: yes
|
|
register: node_ready
|
|
until: node_ready.status == 200
|
|
retries: 12
|
|
delay: 5
|
|
with_items:
|
|
- "{{ rqlite_node_list }}"
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: Check cluster status
|
|
shell: "curl -s http://{{ hostvars[rqlite_leader_node]['ansible_host'] }}:{{ rqlite_http_port }}/nodes?pretty"
|
|
register: cluster_status
|
|
changed_when: false
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: Display cluster status
|
|
debug:
|
|
var: cluster_status.stdout_lines
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: Verify node count
|
|
debug:
|
|
msg: "Successfully configured {{ rqlite_node_list | length }} rqlite nodes"
|
|
delegate_to: localhost
|
|
run_once: true
|
|
|
|
- name: Display cluster information
|
|
debug:
|
|
msg:
|
|
- "rqlite cluster validation summary:"
|
|
- "Leader node: {{ hostvars[rqlite_leader_node]['ansible_host'] }}"
|
|
- "Follower nodes: {{ rqlite_node_list | difference([rqlite_leader_node]) | map('extract', hostvars, 'ansible_host') | list | join(', ') }}"
|
|
- "HTTP API port: {{ rqlite_http_port }}"
|
|
- "Raft consensus port: {{ rqlite_raft_port }}"
|
|
delegate_to: localhost
|
|
run_once: true
|