change: use check mode to verify updates available
This commit is contained in:
@@ -55,6 +55,20 @@
|
||||
|
||||
- block:
|
||||
|
||||
- name: Refresh repositories
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
|
||||
- name: Check if upgrades are available
|
||||
ansible.builtin.apt:
|
||||
upgrade: dist
|
||||
check_mode: true
|
||||
register: apt_check
|
||||
|
||||
- name: Proceed if updates are available
|
||||
when: not apt_check.changed
|
||||
block:
|
||||
|
||||
- name: Enable maintenance mode
|
||||
ansible.builtin.command: >
|
||||
ha-manager crm-command node-maintenance enable {{ inventory_hostname_short }}
|
||||
@@ -79,11 +93,9 @@
|
||||
|
||||
- name: Update packages
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
upgrade: full
|
||||
autoremove: true
|
||||
autoclean: true
|
||||
register: update_packages
|
||||
|
||||
- name: Get version after upgrade
|
||||
ansible.builtin.shell: pveversion | awk -F'/' '{print $2}'
|
||||
@@ -91,9 +103,6 @@
|
||||
delegate_to: "{{ groups['nodes'][0] }}"
|
||||
changed_when: false
|
||||
|
||||
- when: update_packages.changed
|
||||
block:
|
||||
|
||||
- name: Disable Ceph rebalancing
|
||||
ansible.builtin.command: ceph osd set noout
|
||||
|
||||
@@ -153,7 +162,6 @@
|
||||
password: "{{ lookup('env', 'NTFY_PASSWORD') }}"
|
||||
force_basic_auth: true
|
||||
body: |
|
||||
Proxmox cluster update completed successfully.
|
||||
{% if hostvars[groups['nodes'][0]].pve_current_version.stdout == hostvars[groups['nodes'][0]].pve_new_version.stdout %}
|
||||
Version unchanged ({{ hostvars[groups['nodes'][0]].pve_new_version.stdout }})
|
||||
{% else %}
|
||||
|
||||
Reference in New Issue
Block a user