diff --git a/wireguard.yml b/wireguard.yml index 59d9414..adf48c0 100644 --- a/wireguard.yml +++ b/wireguard.yml @@ -31,6 +31,15 @@ name: "wg-quick@{{ wg_interface }}" state: started enabled: true + - name: enable IP forwarding + lineinfile: + path: /etc/sysctl.conf + regexp: "{{ item }}" + line: "{{ item }}=1" + with_items: + - net.ipv4.ip_forward + - net.ipv6.conf.all.forwarding + notify: reload sysconfig handlers: - name: read wg config service: @@ -40,6 +49,8 @@ # command: "wg setconf {{ wg_interface }} /etc/wireguard/{{ wg_interface }}.conf" # - name: reload interface # shell: "ifdown {{ wg_interface }}; ifup {{ wg_interface }}" + - name: reload sysconfig + command: sysctl -p /etc/sysctl.conf - name: Generate client configs hosts: localhost tasks: