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