chore: cleaning
This commit is contained in:
@@ -5,10 +5,6 @@
|
|||||||
become: true
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Verify cluster health
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- delegate_to: "{{ groups['nodes'][0] }}"
|
- delegate_to: "{{ groups['nodes'][0] }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
block:
|
block:
|
||||||
@@ -25,11 +21,7 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: "'HEALTH_OK' not in ceph_health.stdout"
|
failed_when: "'HEALTH_OK' not in ceph_health.stdout"
|
||||||
|
|
||||||
##########################################################
|
- name: Get version before upgrade
|
||||||
# Capture current versions
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Capture version before upgrade
|
|
||||||
ansible.builtin.shell: pveversion | awk -F'/' '{print $2}'
|
ansible.builtin.shell: pveversion | awk -F'/' '{print $2}'
|
||||||
register: pve_current_version
|
register: pve_current_version
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@@ -63,18 +55,10 @@
|
|||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Enable maintenance mode
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- 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 }}
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Wait until node empty
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Wait for LXCs to leave node
|
- name: Wait for LXCs to leave node
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
pct list | awk 'NR>1 && $2=="running" {count++} END {print count+0}'
|
pct list | awk 'NR>1 && $2=="running" {count++} END {print count+0}'
|
||||||
@@ -93,10 +77,6 @@
|
|||||||
retries: 60
|
retries: 60
|
||||||
delay: 15
|
delay: 15
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Update packages
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Update packages
|
- name: Update packages
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
@@ -104,20 +84,12 @@
|
|||||||
autoremove: true
|
autoremove: true
|
||||||
autoclean: true
|
autoclean: true
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Capture new versions
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- 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}'
|
||||||
register: pve_new_version
|
register: pve_new_version
|
||||||
delegate_to: "{{ groups['nodes'][0] }}"
|
delegate_to: "{{ groups['nodes'][0] }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Reboot with Ceph rebalancing disabled
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Disable Ceph rebalancing
|
- name: Disable Ceph rebalancing
|
||||||
ansible.builtin.command: ceph osd set noout
|
ansible.builtin.command: ceph osd set noout
|
||||||
|
|
||||||
@@ -129,18 +101,10 @@
|
|||||||
- name: Enable Ceph rebalancing
|
- name: Enable Ceph rebalancing
|
||||||
ansible.builtin.command: ceph osd unset noout
|
ansible.builtin.command: ceph osd unset noout
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Disable maintenance mode
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Disable maintenance mode
|
- name: Disable maintenance mode
|
||||||
ansible.builtin.command: >
|
ansible.builtin.command: >
|
||||||
ha-manager crm-command node-maintenance disable {{ inventory_hostname_short }}
|
ha-manager crm-command node-maintenance disable {{ inventory_hostname_short }}
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Ceph validation
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Wait for Ceph to be healthy
|
- name: Wait for Ceph to be healthy
|
||||||
ansible.builtin.command: ceph health
|
ansible.builtin.command: ceph health
|
||||||
register: ceph_status
|
register: ceph_status
|
||||||
@@ -152,10 +116,6 @@
|
|||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
|
|
||||||
##########################################################
|
|
||||||
# Send notification
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
- name: Send failure notification
|
- name: Send failure notification
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "{{ ntfy_url }}/{{ ntfy_topic }}"
|
url: "{{ ntfy_url }}/{{ ntfy_topic }}"
|
||||||
@@ -200,6 +160,5 @@
|
|||||||
Title: "Proxmox Update Completed"
|
Title: "Proxmox Update Completed"
|
||||||
Priority: "3"
|
Priority: "3"
|
||||||
Tags: "white_check_mark"
|
Tags: "white_check_mark"
|
||||||
delegate_to: localhost
|
|
||||||
when: ntfy_url is defined
|
when: ntfy_url is defined
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user