You've already forked role_proxmox
Compare commits
2 Commits
47345a9c95
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e3f6c9b02e | |||
| d4c68a3ed3 |
@@ -59,3 +59,35 @@
|
|||||||
retries: 100
|
retries: 100
|
||||||
delay: 36
|
delay: 36
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Disable maintenance mode on node
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- ha-manager
|
||||||
|
- crm-command
|
||||||
|
- node-maintenance
|
||||||
|
- disable
|
||||||
|
- "{{ inventory_hostname_short }}"
|
||||||
|
become: true
|
||||||
|
register: proxmox_maintenance_disabled
|
||||||
|
changed_when: proxmox_maintenance_disabled.rc == 0
|
||||||
|
listen: Disable maintenance mode
|
||||||
|
|
||||||
|
- name: Wait for the instances to return to the current host
|
||||||
|
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_current_instances
|
||||||
|
retries: 20
|
||||||
|
delay: 30
|
||||||
|
until: current == expected
|
||||||
|
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
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -28,6 +40,7 @@
|
|||||||
become: true
|
become: true
|
||||||
register: proxmox_maintenance_enabled
|
register: proxmox_maintenance_enabled
|
||||||
changed_when: proxmox_maintenance_enabled.rc == 0
|
changed_when: proxmox_maintenance_enabled.rc == 0
|
||||||
|
notify: Disable maintenance mode
|
||||||
|
|
||||||
- name: Wait for the instances to be migrated
|
- name: Wait for the instances to be migrated
|
||||||
community.proxmox.proxmox_vm_info:
|
community.proxmox.proxmox_vm_info:
|
||||||
@@ -42,7 +55,7 @@
|
|||||||
register: proxmox_current_instances
|
register: proxmox_current_instances
|
||||||
retries: 20
|
retries: 20
|
||||||
delay: 30
|
delay: 30
|
||||||
until: proxmox_current_instances.proxmox_vms | selectattr('hastate', 'equalto', 'started') | list | length == 0
|
until: proxmox_current_instances.proxmox_vms | selectattr('hastate', 'defined') | selectattr('hastate', 'equalto', 'started') | list | length == 0
|
||||||
|
|
||||||
- name: Run the full-upgrade
|
- name: Run the full-upgrade
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
@@ -81,33 +94,11 @@
|
|||||||
split('/') | first | list
|
split('/') | first | list
|
||||||
check_mode: true
|
check_mode: true
|
||||||
|
|
||||||
- name: Disable maintenance node
|
- name: Autoremove apt packages
|
||||||
ansible.builtin.command:
|
ansible.builtin.apt:
|
||||||
argv:
|
autoremove: true
|
||||||
- ha-manager
|
purge: true
|
||||||
- crm-command
|
become: true
|
||||||
- node-maintenance
|
|
||||||
- disable
|
|
||||||
- "{{ inventory_hostname_short }}"
|
|
||||||
become: true
|
|
||||||
register: proxmox_maintenance_disabled
|
|
||||||
changed_when: proxmox_maintenance_disabled.rc == 0
|
|
||||||
|
|
||||||
- name: Wait for the node to come out of maintenance
|
- name: Flush handlers
|
||||||
ansible.builtin.command: # noqa: no-changed-when
|
ansible.builtin.meta: flush_handlers
|
||||||
argv:
|
|
||||||
- ha-manager
|
|
||||||
- status
|
|
||||||
become: true
|
|
||||||
register: proxmox_ha_manager_status
|
|
||||||
changed_when: >-
|
|
||||||
proxmox_ha_manager_status.stdout_lines |
|
|
||||||
select('search', 'lrm ' + inventory_hostname_short) |
|
|
||||||
regex_search('active', ignorecase=true)
|
|
||||||
retries: 20
|
|
||||||
delay: 30
|
|
||||||
until: >-
|
|
||||||
not
|
|
||||||
proxmox_ha_manager_status.stdout_lines |
|
|
||||||
select('search', 'lrm ' + inventory_hostname_short) |
|
|
||||||
regex_search('active', ignorecase=true)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user