1
0
Fork 0
forked from infra/ansible

base: disable iptables service when nftables is enabled

When `nftables=True` the base role deploys nftables rules and enables the
nftables service, but never disables the iptables service. On freshly
provisioned hosts the iptables service can be left running from cloud-init,
overwriting nftables rules and silently dropping traffic on ports defined
in `tcp_ports`.

Stop and disable the iptables service explicitly when nftables is the
intended firewall backend.
This commit is contained in:
Jiri Kyjovsky 2026-04-01 00:17:11 +02:00 committed by Kevin Fenzi
commit 99f1ff2202

View file

@ -276,6 +276,16 @@
- baseiptables|bool
- not nftables
- name: Iptables service disabled
service: name=iptables state=stopped enabled=false
tags:
- iptables
- service
- base
when:
- baseiptables|bool
- nftables
- name: Nftables service enabled
service: name=nftables state=started enabled=true
tags: