diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-06-14 01:02:17 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-06-14 01:02:17 +0200 |
| commit | 321b616270d75cd1f79de84942afa0a62379304d (patch) | |
| tree | 864708318e330446c2f1cff184e435827ec8f982 /roles | |
| parent | 94c7beac4fc43eaf26c5f3836ee079f650f24b26 (diff) | |
Fix gateway role after rpi os update
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/gateway/handlers/main.yml | 2 | ||||
| -rw-r--r-- | roles/gateway/tasks/main.yml | 15 | ||||
| -rw-r--r-- | roles/gateway/templates/99-gateway.conf.j2 | 7 |
3 files changed, 13 insertions, 11 deletions
diff --git a/roles/gateway/handlers/main.yml b/roles/gateway/handlers/main.yml index 5dae0f76..6cceffd5 100644 --- a/roles/gateway/handlers/main.yml +++ b/roles/gateway/handlers/main.yml @@ -2,7 +2,7 @@ - name: "Reload sysctl" become: true ansible.builtin.command: - cmd: "sysctl -p" + cmd: "sysctl --system" changed_when: false - name: "Reload systemd" diff --git a/roles/gateway/tasks/main.yml b/roles/gateway/tasks/main.yml index a571dd52..f4826a72 100644 --- a/roles/gateway/tasks/main.yml +++ b/roles/gateway/tasks/main.yml @@ -10,17 +10,12 @@ - name: "Configure IP forwarding" become: true - ansible.builtin.blockinfile: - path: "/etc/sysctl.conf" - state: "{{ 'present' if gateway_enabled else 'absent' }}" - prepend_newline: true - append_newline: true - marker: "# ==== {mark} ANSIBLE GATEWAY CONFIG" - create: true + ansible.builtin.template: + src: "99-gateway.conf.j2" + dest: "/etc/sysctl.d/99-gateway.conf" + owner: "root" + group: "root" mode: "0644" - block: | - net.ipv4.ip_forward=1 - net.ipv6.conf.all.forwarding=1 notify: "Reload sysctl" - name: "Deploy gateway apply rules script" diff --git a/roles/gateway/templates/99-gateway.conf.j2 b/roles/gateway/templates/99-gateway.conf.j2 new file mode 100644 index 00000000..40ba5a72 --- /dev/null +++ b/roles/gateway/templates/99-gateway.conf.j2 @@ -0,0 +1,7 @@ +{% if gateway_enabled %} +net.ipv4.ip_forward=1 +net.ipv6.conf.all.forwarding=1 +{% else %} +net.ipv4.ip_forward=0 +net.ipv6.conf.all.forwarding=0 +{% endif %} |
