32 lines
876 B
YAML
32 lines
876 B
YAML
---
|
|
# tasks file for nftables
|
|
|
|
- name: Build rules list
|
|
ansible.builtin.set_fact:
|
|
nftables_rules: "{{ nftables_rules + specific }}"
|
|
when: specific | length > 0
|
|
loop: "{{ lookup('ansible.builtin.varnames', '^nftables_rules_.+', wantlist=True) }}"
|
|
vars:
|
|
specific: "{{ lookup('ansible.builtin.vars', item, default='') }}"
|
|
|
|
- name: Deploy configuration file
|
|
ansible.builtin.template:
|
|
src: "{{ nftables_conf_template }}"
|
|
dest: "{{ nftables_conf_path }}"
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=,o=
|
|
become: true
|
|
notify: Restart nftables.service
|
|
|
|
- name: Enable IP forwarding
|
|
ansible.builtin.template:
|
|
src: 100-ip_forwarding.conf.j2
|
|
dest: "{{ nftables_ip_forwarding_path }}"
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,g=r,o=r
|
|
when: nftables_ip_forwarding_path | length > 0
|
|
become: true
|
|
notify: Enable 100-ip_forwarding.conf
|