Initial commit

This commit is contained in:
2026-02-21 16:54:18 +01:00
commit 0cf33cd95b
80 changed files with 8042 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
---
- name: Remove existing WireGuard interface
community.routeros.command:
commands:
- /interface wireguard remove [find name="wg-{{ gateway_config.lab_name }}"]
ignore_errors: yes
- name: Create WireGuard interface
community.routeros.command:
commands:
- /interface wireguard add name="wg-{{ gateway_config.lab_name }}" listen-port={{ gateway_config.wg_listen_port }} private-key="{{ gateway_config.wg_private_key }}"
- /ip address add address={{ gateway_config.wg_ip }}/{{ gateway_config.wg_net | ipaddr("prefix") }} interface="wg-{{ gateway_config.lab_name }}"
- name: Configure WireGuard peers
community.routeros.command:
commands:
- /interface wireguard peers add interface="wg-{{ gateway_config.lab_name }}" public-key="{{ peer.public_key }}" endpoint-address={{ peer.endpoint }} endpoint-port={{ gateway_config.wg_listen_port }} allowed-address={{ peer.wg_ip }}/32 persistent-keepalive=25s
loop: "{{ gateway_config.peers }}"
loop_control:
loop_var: peer