---
- name: Enable IPv4 forwarding
  sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes

- name: Enable ufw firewall
  ufw: state=enabled

- name: Enable ufw logging
  ufw: logging=on

- name: Change DEFAULT_FORWARD_POLICY to ACCEPT
  lineinfile: dest=/etc/default/ufw regexp='^DEFAULT_FORWARD_POLICY=' line='DEFAULT_FORWARD_POLICY="ACCEPT"'

- name: Masquerade traffic from VPN to the world
  template: src=templates/before.rules dest=/etc/ufw/before.rules mode=0640 owner=root group=root

- name: Allow SSH connections
  ufw: rule=allow port=22 proto=tcp

- name: Allow OpenVPN connections
  ufw: rule=allow port=1194 proto=udp

- name: Allow DNS connections
  ufw: rule=allow port=53 proto=udp src=10.8.0.0/24

- name: Reload ufw
  ufw: state=reloaded

---
- name: Enable IPv4 forwarding
  sysctl: name="net.ipv4.ip_forward" value=1 sysctl_set=yes

- name: Enable ufw firewall
  ufw: state=enabled

- name: Enable ufw logging
  ufw: logging=on

- name: Change DEFAULT_FORWARD_POLICY to ACCEPT
  lineinfile: dest=/etc/default/ufw regexp='^DEFAULT_FORWARD_POLICY=' line='DEFAULT_FORWARD_POLICY="ACCEPT"'

- name: Masquerade traffic from VPN to the world
  template: src=before.rules dest=/etc/ufw/before.rules mode=0640 owner=root group=root

- name: Allow SSH connections
  ufw: rule=allow port=22 proto=tcp

- name: Allow OpenVPN connections
  ufw: rule=allow port=1194 proto=udp

- name: Allow DNS connections
  ufw: rule=allow port=53 proto=udp src=10.8.0.0/24

- name: Reload ufw
  ufw: state=reloaded

Fix template for openvpn firewall rules.
Fix template for openvpn firewall rules.
