feat: Manage ipforwarding
This commit is contained in:
@@ -7,5 +7,8 @@ nftables_conf_template: nftables.conf.j2
|
||||
# Default configuration path
|
||||
nftables_conf_path: /etc/nftables.conf
|
||||
|
||||
# Path of sysctl ipforwarding file
|
||||
nftables_ip_forwarding_path: ""
|
||||
|
||||
# List of rules to deploy
|
||||
nftables_rules: []
|
||||
|
||||
@@ -8,3 +8,12 @@
|
||||
enabled: true
|
||||
masked: false
|
||||
become: true
|
||||
|
||||
- name: Enable 100-ip_forwarding.conf
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- sysctl
|
||||
- -p
|
||||
- "{{ nftables_ip_forwarding_path }}"
|
||||
removes: "{{ nftables_ip_forwarding_path }}"
|
||||
become: true
|
||||
|
||||
@@ -18,3 +18,14 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
net.ipv4.conf.all.forwarding = 1
|
||||
net.ipv6.conf.all.forwarding = 1
|
||||
Reference in New Issue
Block a user