feat(ansible): add VPN node configuration automation

This commit is contained in:
2026-06-10 12:36:27 +02:00
parent 89efd6430d
commit 5e6d4c1479
32 changed files with 526 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
+2
View File
@@ -0,0 +1,2 @@
---
# defaults file for roles/networking
+4
View File
@@ -0,0 +1,4 @@
---
# handlers file for roles/networking
- name: reload sysctl
command: sysctl --system
+19
View File
@@ -0,0 +1,19 @@
---
- name: Ensure bridge-utils is installed
apt:
name:
- bridge-utils
- vlan
- iproute2
state: present
- name: Create bridge if missing
command: ip link add br-main-vpn type bridge
register: bridge_create
failed_when: false
changed_when: bridge_create.rc == 0
- name: Bring bridge up
command: ip link set br-main-vpn up
failed_when: false
changed_when: false
+16
View File
@@ -0,0 +1,16 @@
---
# tasks file for roles/networking
- name: Deploy networking sysctl configuration
template:
src: 99-openvpn.conf.j2
dest: /etc/sysctl.d/99-openvpn.conf
owner: root
group: root
mode: "0644"
notify: reload sysctl
- name: Apply sysctl immediately
command: sysctl --system
changed_when: false
- import_tasks: bridge.yml
@@ -0,0 +1,6 @@
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.enp7s0.rp_filter=0