unattended_upgrades: needrestart lists services instead of restarting them, replaces the package blacklist

This commit is contained in:
2026-11-14 08:00:30 +00:00
parent 704a5d9389
commit f32e6930f5
4 changed files with 17 additions and 15 deletions
-7
View File
@@ -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
+15
View File
@@ -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
@@ -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";
@@ -0,0 +1,2 @@
# {{ ansible_managed }}
$nrconf{restart} = 'l';