ansible-edda/plays/system/roles/base/tasks/include/nftables.yml

29 lines
732 B
YAML

- name: "nftables : install nftables"
ansible.builtin.apt:
name: "nftables"
- name: "nftables : configure nftables"
ansible.builtin.template:
src: "./nftables/nftables.conf.j2"
dest: "/etc/nftables.conf"
mode: 0755
register: system_base_nftables_conf
- name: "nftables : enable nftables"
ansible.builtin.systemd:
name: "nftables"
enabled: true
- name: "nftables : start nftables"
ansible.builtin.systemd:
name: "nftables"
state: "started"
register: system_base_nftables_start
- name: "nftables : reload nftables configuration"
ansible.builtin.command:
cmd: "nft -f /etc/nftables.conf"
when:
system_base_nftables_conf.changed and
not system_base_nftables_start.changed