Refactor os-updates: deb822 support, codename alignment, logging, reboot task, drop major-version upgrade; add healthcheck to update playbook
This commit is contained in:
@@ -1,27 +1,17 @@
|
||||
- name: Run preflight logging
|
||||
include_tasks: logging_preflight.yml
|
||||
|
||||
- name: Upgrade all installed packages
|
||||
apt:
|
||||
upgrade: full
|
||||
update_cache: yes
|
||||
notify:
|
||||
register: os_update_upgrade_result
|
||||
notify:
|
||||
- apt cleanup
|
||||
- apt autoremove
|
||||
|
||||
- name: Check if a kernel update is available
|
||||
shell: |
|
||||
dpkg -l | grep -E '^ii' | grep 'linux-image-[0-9]' | awk '{print $2}' | sort | tail -n 1
|
||||
register: latest_kernel
|
||||
when: ansible_virtualization_type != 'lxc'
|
||||
- name: Run reboot decision and reboot if required
|
||||
include_tasks: reboot.yml
|
||||
|
||||
- name: Check if running kernel matches the latest installed kernel
|
||||
shell: |
|
||||
echo "{{ latest_kernel.stdout }}" | grep -c $(uname -r)
|
||||
register: kernel_match
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
when: ansible_virtualization_type != 'lxc'
|
||||
|
||||
- name: Mark reboot required if a new kernel is installed
|
||||
set_fact:
|
||||
reboot_required: "yes"
|
||||
when:
|
||||
- ansible_virtualization_type != 'lxc'
|
||||
- kernel_match.stdout == "0"
|
||||
- name: Run postflight logging
|
||||
include_tasks: logging_postflight.yml
|
||||
Reference in New Issue
Block a user