fix: Wait for the instances to return to the current host

This commit is contained in:
2026-03-17 23:08:43 +01:00
parent d4c68a3ed3
commit e3f6c9b02e
2 changed files with 30 additions and 15 deletions

View File

@@ -73,18 +73,21 @@
changed_when: proxmox_maintenance_disabled.rc == 0 changed_when: proxmox_maintenance_disabled.rc == 0
listen: Disable maintenance mode listen: Disable maintenance mode
# TO DEBUG: - name: Wait for the instances to return to the current host
#- name: Wait until node quits maintenance mode community.proxmox.proxmox_vm_info:
# ansible.builtin.command: api_host: "{{ proxmox_api_host }}"
# argv: api_token_id: "{{ proxmox_api_token_id }}"
# - ha-manager api_token_secret: "{{ proxmox_api_token_secret }}"
# - status api_user: "{{ proxmox_api_user }}"
# become: true node: "{{ inventory_hostname_short }}"
# register: proxmox_ha_manager_status type: all
# changed_when: >- validate_certs: "{{ proxmox_api_validate_certs }}"
# proxmox_ha_manager_status.stdout_lines | select("search", "lrm " + inventory_hostname_short +" (active") | list | length > 0 become: true
# retries: 20 register: proxmox_current_instances
# delay: 30 retries: 20
# until: >- delay: 30
# proxmox_ha_manager_status.stdout_lines | select("search", "lrm " + inventory_hostname_short + " (active") | list | length > 0 until: current == expected
# listen: Disable maintenance mode vars:
current: "{{ proxmox_current_instances.proxmox_vms | map(attribute='name') | sort }}"
expected: "{{ proxmox_node_instances.proxmox_vms | map(attribute='name') | sort }}"
listen: Disable maintenance mode

View File

@@ -17,6 +17,18 @@
- name: Upgrade tasks - name: Upgrade tasks
when: apt_upgradable.stdout_lines | length > 1 when: apt_upgradable.stdout_lines | length > 1
block: block:
- name: List instance on the current node
community.proxmox.proxmox_vm_info:
api_host: "{{ proxmox_api_host }}"
api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}"
api_user: "{{ proxmox_api_user }}"
node: "{{ inventory_hostname_short }}"
type: all
validate_certs: "{{ proxmox_api_validate_certs }}"
become: true
register: proxmox_node_instances
- name: Enable maintenance node - name: Enable maintenance node
ansible.builtin.command: ansible.builtin.command:
argv: argv: