ansible-roles/system/base/nftables/tasks/main.yml

30 lines
669 B
YAML
Raw Normal View History

2022-12-20 19:47:11 +01:00
---
- name: "install nftables"
ansible.builtin.apt:
name: "nftables"
- name: "configure nftables"
ansible.builtin.template:
2023-07-08 09:45:59 +02:00
src: "./nftables.conf"
2022-12-20 19:47:11 +01:00
dest: "/etc/nftables.conf"
mode: 0755
register: system_base_nftables_conf
- name: "enable nftables"
ansible.builtin.systemd:
name: "nftables"
enabled: true
- name: "start nftables"
ansible.builtin.systemd:
name: "nftables"
state: "started"
register: system_base_nftables_start
- name: "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