OpenVPN Ansible / Ansible Syntax Check (push) Successful in 10s
OpenVPN Ansible / Ansible Lint (push) Successful in 17s
OpenVPN Ansible / Deploy VPN Networking and OpenVPN (push) Failing after 9s
OpenVPN Ansible / Generate SBOM (push) Skipped
OpenVPN Ansible / Scan SBOM with Trivy (push) Skipped
- Add NAT gateway inventory and routing playbooks. - Update Gitea Actions and GitLab CI to validate all playbooks. - Deploy gateway and routing configurations before OpenVPN. - Document setup and verification steps.
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
---
|
|
- name: Install persistent iptables support
|
|
ansible.builtin.apt:
|
|
name: [iptables, iptables-persistent]
|
|
state: present
|
|
|
|
- name: Configure persistent IPv4 forwarding
|
|
ansible.builtin.copy:
|
|
dest: /etc/sysctl.d/99-nat-gateway.conf
|
|
content: "net.ipv4.ip_forward=1\n"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Apply NAT gateway sysctl
|
|
|
|
- name: Enable IPv4 forwarding immediately
|
|
ansible.posix.sysctl:
|
|
name: net.ipv4.ip_forward
|
|
value: "1"
|
|
sysctl_file: /etc/sysctl.d/99-nat-gateway.conf
|
|
reload: true
|
|
|
|
- name: Allow private subnet outbound through public interface
|
|
ansible.builtin.iptables:
|
|
table: nat
|
|
chain: POSTROUTING
|
|
source: "{{ nat_gateway_private_cidr }}"
|
|
out_interface: "{{ nat_gateway_public_interface }}"
|
|
jump: MASQUERADE
|
|
state: present
|
|
notify: Save NAT gateway firewall
|
|
|
|
- name: Allow private subnet forwarding to public interface
|
|
ansible.builtin.iptables:
|
|
chain: FORWARD
|
|
in_interface: "{{ nat_gateway_private_interface }}"
|
|
out_interface: "{{ nat_gateway_public_interface }}"
|
|
source: "{{ nat_gateway_private_cidr }}"
|
|
jump: ACCEPT
|
|
state: present
|
|
notify: Save NAT gateway firewall
|
|
|
|
- name: Allow established return traffic to private subnet
|
|
ansible.builtin.iptables:
|
|
chain: FORWARD
|
|
in_interface: "{{ nat_gateway_public_interface }}"
|
|
out_interface: "{{ nat_gateway_private_interface }}"
|
|
destination: "{{ nat_gateway_private_cidr }}"
|
|
ctstate: [ESTABLISHED, RELATED]
|
|
jump: ACCEPT
|
|
state: present
|
|
notify: Save NAT gateway firewall
|
|
|
|
- name: Assert gateway retains public default route
|
|
ansible.builtin.command: ip -4 route show default
|
|
register: nat_gateway_default_route
|
|
changed_when: false
|
|
failed_when: nat_gateway_public_interface not in nat_gateway_default_route.stdout
|