3 # @TODO: Should 3rd party sources be removed?
4 # @TODO: Ensure kernel package is installed
5 # @TODO: Should a 2nd sshd be started on a non-standard port in case of failure?
11 cmd: 'apt-mark showhold'
12 - name: remove all holds
14 cmd: "apt-mark unhold '*'"
15 - name: Replace release in apt sources.list
17 regexp: "{{ansible_distribution_release}}"
18 replace: "{{next_release}}"
19 path: /etc/apt/sources.list
20 - name: Replace release in apt sources.list.d
22 cmd: "sed -i 's/{{ansible_distribution_release}}/{{next_release}}/' /etc/apt/sources.list.d/*"
27 # @TODO: Check required disk space and available disk space
28 - name: Download packages
30 cmd: 'apt-get -y -d upgrade {{apt_common_options}}'
32 environment: "{{apt_noninteractive_environment}}"
33 - name: Minimal upgrade run
35 cmd: 'apt upgrade -y --without-new-pkgs {{apt_common_options}}'
37 environment: "{{apt_noninteractive_environment}}"
38 - name: Full upgrade run
40 cmd: 'apt full-upgrade -y {{apt_common_options}}'
42 environment: "{{apt_noninteractive_environment}}"
43 # @TODO: reconfigure grub if installed
44 # `dpkg-reconfigure grub-pc` on many systems, but not all
45 # @TODO: Our instances often have an OS version identifier,
46 # it would be handy to do a replace in /etc/hostname
49 command: /usr/sbin/reboot
54 - name: wait for the server to reboot
55 local_action: wait_for host={{ inventory_hostname }}
60 when: last_result.changed
62 - name: Purge configuration of removed packages
64 cmd: "apt -y purge '~c'"
66 environment: "{{apt_noninteractive_environment}}"
67 - name: Purge obsolete packages
69 cmd: "apt -y purge '~o'"
71 environment: "{{apt_noninteractive_environment}}"