diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-01-04 15:04:54 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-01-04 15:06:49 +0100 |
commit | cc70c3640eeb06d9129cd624c0750f2db70648a7 (patch) | |
tree | 864b088bc0149cc6e19d9c0e3f67e5b5f3916af1 /ansible/roles/lxc-host/tasks/ufw-nat.yml | |
parent | 33700d2b70a1f3fbfd412a0483865f930cb2facc (diff) | |
download | infra-cc70c3640eeb06d9129cd624c0750f2db70648a7.tar.gz infra-cc70c3640eeb06d9129cd624c0750f2db70648a7.tar.bz2 infra-cc70c3640eeb06d9129cd624c0750f2db70648a7.tar.xz infra-cc70c3640eeb06d9129cd624c0750f2db70648a7.zip |
lxc-host: Major refactoring.
o Removing radvd support, should be handled by itself. Better support
for setting ipv6 addresses instead.
o Moving out UFW stupport, should be moved to the ufw package.
o Better variables, default and file names.
Diffstat (limited to 'ansible/roles/lxc-host/tasks/ufw-nat.yml')
-rw-r--r-- | ansible/roles/lxc-host/tasks/ufw-nat.yml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ansible/roles/lxc-host/tasks/ufw-nat.yml b/ansible/roles/lxc-host/tasks/ufw-nat.yml new file mode 100644 index 0000000..219b70b --- /dev/null +++ b/ansible/roles/lxc-host/tasks/ufw-nat.yml @@ -0,0 +1,21 @@ +- name: + tags: + - lxc-host + - lxc-host-network + block: + - name: Enable NAT configuration through UFW + become: yes + notify: reload ufw + blockinfile: + path: /etc/ufw/before.rules + insertbefore: "# Don't delete these required lines, otherwise there will be errors" + block: | + # NAT table rules + *nat + :POSTROUTING ACCEPT [0:0] + + # Forward traffic through eth0 - Change to match you out-interface + -A POSTROUTING -s {{ internal_if.ipv4.address }}/{{ internal_if.ipv4.netmask }} -o {{ lxc_host__hardware_if }} -j MASQUERADE + + # don't delete the 'COMMIT' line or these nat table rules won't be processed + COMMIT |