ansible-edda/playbooks/roles/system/nftables/tasks/main.yml

29 lines
668 B
YAML
Raw Normal View History

2022-12-18 19:01:04 +01:00
- name: "install nftables"
ansible.builtin.apt:
name: "nftables"
2022-12-18 19:01:04 +01:00
- name: "configure nftables"
ansible.builtin.template:
2022-12-18 19:01:04 +01:00
src: "./nftables.conf.j2"
dest: "/etc/nftables.conf"
mode: 0755
2022-12-08 23:19:54 +01:00
register: system_base_nftables_conf
2022-12-18 19:01:04 +01:00
- name: "enable nftables"
ansible.builtin.systemd:
name: "nftables"
enabled: true
2022-12-18 19:01:04 +01:00
- name: "start nftables"
ansible.builtin.systemd:
name: "nftables"
state: "started"
2022-12-08 23:19:54 +01:00
register: system_base_nftables_start
2022-12-18 19:01:04 +01:00
- name: "reload nftables configuration"
ansible.builtin.command:
cmd: "nft -f /etc/nftables.conf"
when:
2022-12-08 23:19:54 +01:00
system_base_nftables_conf.changed and
not system_base_nftables_start.changed