61 lines
2.2 KiB
YAML

---
- name: Capture final cluster node table from anchor
ansible.builtin.command: pvecm nodes
register: proxmox_cluster_reconcile_v2_final_nodes
changed_when: false
become: true
delegate_to: "{{ join_target_host }}"
- name: Capture final cluster status from anchor
ansible.builtin.command: pvecm status
register: proxmox_cluster_reconcile_v2_final_status
changed_when: false
become: true
delegate_to: "{{ join_target_host }}"
- name: Assert join node is present and cluster is quorate
ansible.builtin.assert:
that:
- proxmox_cluster_reconcile_v2_final_nodes.stdout is search('\\b' ~ join_node ~ '\\b')
- proxmox_cluster_reconcile_v2_final_status.stdout is search('Quorate:\\s+Yes')
fail_msg: >-
Cluster validation failed. {{ join_node }} is missing or quorum is not healthy.
success_msg: "Cluster validation passed."
- name: Capture service state on joined node
ansible.builtin.command: systemctl is-active pve-cluster corosync pve-ha-lrm
register: proxmox_cluster_reconcile_v2_join_service_state
changed_when: false
failed_when: false
become: true
delegate_to: "{{ join_node }}"
- name: Create output directory for reconciliation artifact
ansible.builtin.file:
path: "{{ proxmox_cluster_reconcile_v2_output_dir }}"
state: directory
mode: '0755'
delegate_to: localhost
- name: Write cluster reconciliation summary artifact
ansible.builtin.copy:
dest: "{{ proxmox_cluster_reconcile_v2_output_dir }}/cluster-reconcile-summary.txt"
mode: '0644'
content: |
Project: {{ cluster_project_name }}
Mode: {{ cluster_mode }}
Join node: {{ join_node }}
Join anchor host: {{ join_target_host }}
Join anchor IP: {{ proxmox_cluster_reconcile_v2_anchor_ip }}
Timestamp: {{ proxmox_cluster_reconcile_v2_timestamp }}
=== pvecm nodes (anchor) ===
{{ proxmox_cluster_reconcile_v2_final_nodes.stdout | default('') }}
=== pvecm status (anchor) ===
{{ proxmox_cluster_reconcile_v2_final_status.stdout | default('') }}
=== service state on join node ===
{{ proxmox_cluster_reconcile_v2_join_service_state.stdout | default('unknown') }}
delegate_to: localhost