diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-09-02 01:30:46 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-09-02 01:30:46 +0200 |
| commit | 744d2521ffc1c68fc0328731275c9fc7751f366d (patch) | |
| tree | 59c829910a6eda6019d8302cb09bbe6604057e55 /roles/wireguard_gateway/tasks | |
| parent | 17f10052bdbc4cf5bfd0e2fa335f13c0165284a5 (diff) | |
Fix pihole and network manger DNS when VPN isn't active
Diffstat (limited to 'roles/wireguard_gateway/tasks')
| -rw-r--r-- | roles/wireguard_gateway/tasks/main.yml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/roles/wireguard_gateway/tasks/main.yml b/roles/wireguard_gateway/tasks/main.yml index a4fb43d8..14f31f54 100644 --- a/roles/wireguard_gateway/tasks/main.yml +++ b/roles/wireguard_gateway/tasks/main.yml @@ -26,7 +26,7 @@ ansible.builtin.iptables: table: "nat" chain: "POSTROUTING" - source: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.prefix }}" + source: "{{ (ansible_default_ipv4.address.split('.')[0:3] | join('.')) }}.0/24" out_interface: "{{ wireguard_autostart_connection }}" jump: "MASQUERADE" comment: "NAT local subnet traffic through VPN" @@ -36,7 +36,7 @@ become: true ansible.builtin.iptables: chain: "FORWARD" - source: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.prefix }}" + source: "{{ (ansible_default_ipv4.address.split('.')[0:3] | join('.')) }}.0/24" jump: "ACCEPT" comment: "Allow forwarding from local subnet" state: "{{ 'present' if wireguard_gateway_enabled else 'absent' }}" |
