Refactor os-updates: deb822 support, codename alignment, logging, reboot task, drop major-version upgrade; add healthcheck to update playbook
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Preflight logging: how many and which packages need to be updated.
|
||||
# Run logging steps only when os_update_logging_enabled is true.
|
||||
|
||||
- name: Logging - Refresh apt cache for accurate preflight
|
||||
apt:
|
||||
update_cache: yes
|
||||
changed_when: false
|
||||
when: os_update_logging_enabled | bool
|
||||
|
||||
- name: Logging - Record start epoch
|
||||
command: date +%s
|
||||
register: os_update_log_start_ts
|
||||
changed_when: false
|
||||
when: os_update_logging_enabled | bool
|
||||
|
||||
- name: Logging - Record start ISO time
|
||||
command: date -Iseconds
|
||||
register: os_update_log_start_iso
|
||||
changed_when: false
|
||||
when: os_update_logging_enabled | bool
|
||||
|
||||
- name: Preflight - Gather upgradable packages
|
||||
command: apt list --upgradable
|
||||
register: os_update_upgradable
|
||||
changed_when: false
|
||||
when: os_update_logging_enabled | bool
|
||||
|
||||
- name: Preflight - Build list of upgradable package names, versions and count
|
||||
set_fact:
|
||||
os_update_upgradable_names: >-
|
||||
{{
|
||||
os_update_upgradable.stdout_lines
|
||||
| select('search', '\[upgradable')
|
||||
| map('regex_replace', '^([^/]+)/.*$', '\1')
|
||||
| list
|
||||
}}
|
||||
os_update_upgradable_versions: >-
|
||||
{{
|
||||
os_update_upgradable.stdout_lines
|
||||
| select('search', '\[upgradable')
|
||||
| map('regex_replace', '^([^/]+)/\S+\s+(\S+)\s+\S+\s+\[upgradable from: (\S+)\]$', '\1 \3 \2')
|
||||
| list
|
||||
}}
|
||||
os_update_upgradable_count: >-
|
||||
{{
|
||||
(os_update_upgradable.stdout_lines | select('search', '\[upgradable') | list | length) | int
|
||||
}}
|
||||
when: os_update_logging_enabled | bool
|
||||
Reference in New Issue
Block a user