refacto: Partial rewrite to manage nodes

This commit is contained in:
2026-03-17 02:07:45 +01:00
parent 0d467d737d
commit c0e0bc169e
11 changed files with 330 additions and 217 deletions

View File

@@ -49,46 +49,13 @@
delegate_to: "{{ proxmox_delegate_to | default(omit) }}"
- name: Wait cloud-init
ansible.builtin.command: # noqa: no-changed-when
ansible.builtin.command:
cmd: cloud-init status
when: proxmox_instance_cloudinit
register: cloudinit_status
until: cloudinit_status.stdout.find("done") != -1
changed_when: cloudinit_status.stdout_lines | select("search", "done") | list | length > 0
failed_when: cloudinit_status.rc == 1
until: cloudinit_status.stdout_lines | select("search", "done") | list | length > 0
retries: 100
delay: 36
ignore_errors: true
- name: Enable maintenance mode
ansible.builtin.command: # noqa: no-changed-when
argv:
- ha-manager
- crm-command
- node-maintenance
- enable
- "{{ inventory_hostname_short }}"
become: true
listen: Upgrade the node
- name: Wait instances migration
ansible.builtin.command: # noqa: no-changed-when
argv:
- ha-manager
- status
become: true
register: ha_manager_status
retries: 10
delay: 60
until: not ha_manager_status.stdout_lines | regex_search('migrate', ignorecase=true)
listen: Upgrade the node
- name: Run the full-upgrade
ansible.builtin.apt:
upgrade: dist
update_cache: true
become: true
listen: Upgrade the node
- name: Reboot
ansible.builtin.reboot:
become: true
listen: Upgrade the node