When nftables.service is enabled, the nftables package's postinst restarts it on upgrade. The stock /etc/nftables.conf begins with `flush ruleset` and the unit's ExecStop flushes too, so every rule ufw and Docker loaded was deleted until they reloaded. The role now masks the unit without stopping it, gated on ufw_enabled and the new opt-out input ufw_mask_nftables. systemd refuses every job but a stop on a masked unit, so the postinst's try-restart fails before anything runs (the postinst ignores the failure) and the unit does not start at boot. Masking works when the unit is absent too. Assisted-by: Claude Code:claude-opus-5-5
12 lines
354 B
YAML
12 lines
354 B
YAML
---
|
|
# A restart of nftables.service (on a package upgrade) flushes the rules ufw loaded. Mask only:
|
|
# a stop would flush them now. README Notes has the detail.
|
|
- name: Mask nftables.service without stopping it
|
|
become: true
|
|
ansible.builtin.systemd_service:
|
|
name: nftables.service
|
|
masked: true
|
|
when:
|
|
- ufw_enabled
|
|
- ufw_mask_nftables
|