diff --git a/unattended_upgrades/defaults/main.yml b/unattended_upgrades/defaults/main.yml index 542f158..6ac3ac1 100644 --- a/unattended_upgrades/defaults/main.yml +++ b/unattended_upgrades/defaults/main.yml @@ -11,13 +11,6 @@ unattended_upgrades: - ${distro_id}:${distro_codename}-security - ${distro_id}ESMApps:${distro_codename}-apps-security - ${distro_id}ESM:${distro_codename}-infra-security - # Regexes matched against the package name start. An upgrade of these makes needrestart/systemd restart every - # service at once, containerd included: the dead FUSE mounts hung systemd-resolved on antius, netbird lost DNS - # and the node went NotReady (2026-11-14). Upgrade them by hand with a reboot. - package_blacklist: - - libc6 - - libc-bin - - systemd # Recipient of the report mail; unset sends none, as no host has an outgoing mail setup. mail: mail_report: only-on-error diff --git a/unattended_upgrades/tasks/main.yml b/unattended_upgrades/tasks/main.yml index 7eb5955..0b29914 100644 --- a/unattended_upgrades/tasks/main.yml +++ b/unattended_upgrades/tasks/main.yml @@ -23,6 +23,21 @@ dest: /etc/apt/apt.conf.d/52unattended-upgrades-local mode: "0644" +# needrestart (Ubuntu default) restarts every service that uses an upgraded library, containerd and netbird included: +# after a libc upgrade the dead FUSE mounts hung systemd-resolved on antius and the node went NotReady (2026-11-14). +# List only; the services pick up the library at the next reboot, which HostRebootRequired tracks. +- name: Check for needrestart + ansible.builtin.stat: + path: /etc/needrestart/conf.d + register: unattended_upgrades_needrestart + +- name: Let needrestart list the services instead of restarting them + ansible.builtin.template: + src: needrestart-list-only.conf.j2 + dest: /etc/needrestart/conf.d/90-list-only.conf + mode: "0644" + when: unattended_upgrades_needrestart.stat.exists + # Debian installs apt-listchanges with email_address=root, which mails the NEWS of every # unattended upgrade through the mail relay. - name: Check for the apt-listchanges config diff --git a/unattended_upgrades/templates/52unattended-upgrades-local.j2 b/unattended_upgrades/templates/52unattended-upgrades-local.j2 index 4f17ec1..8cc9a0a 100644 --- a/unattended_upgrades/templates/52unattended-upgrades-local.j2 +++ b/unattended_upgrades/templates/52unattended-upgrades-local.j2 @@ -19,14 +19,6 @@ Unattended-Upgrade::Allowed-Origins { }; {% endif %} -{% if unattended_upgrades.package_blacklist %} -Unattended-Upgrade::Package-Blacklist { -{% for pkg in unattended_upgrades.package_blacklist %} - "{{ pkg }}"; -{% endfor %} -}; -{% endif %} - // No automatic reboot, the owner schedules those. Unattended-Upgrade::Automatic-Reboot "false"; Unattended-Upgrade::Remove-Unused-Kernel-Packages "true"; diff --git a/unattended_upgrades/templates/needrestart-list-only.conf.j2 b/unattended_upgrades/templates/needrestart-list-only.conf.j2 new file mode 100644 index 0000000..b861245 --- /dev/null +++ b/unattended_upgrades/templates/needrestart-list-only.conf.j2 @@ -0,0 +1,2 @@ +# {{ ansible_managed }} +$nrconf{restart} = 'l';