mirror of
https://github.com/pikami/mail-server.git
synced 2025-12-19 17:10:54 +00:00
Configure wireguard VPN
This commit is contained in:
13
ansible/templates/wireguard.conf.j2
Normal file
13
ansible/templates/wireguard.conf.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
{% set _wg = lookup('vars', inventory_hostname + '_wg') %}
|
||||
# {{ ansible_managed }}
|
||||
[Interface]
|
||||
PrivateKey = {{ _wg.private_key }}
|
||||
ListenPort = {{ _wg.port }}
|
||||
|
||||
{% for peer in _wg.peers %}
|
||||
[Peer]
|
||||
# {{ peer.name }}
|
||||
PublicKey = {{ peer.public_key }}
|
||||
Endpoint = {{ peer.endpoint }}
|
||||
AllowedIPs = {{ peer.allowed_ips }}
|
||||
{% endfor %}
|
||||
6
ansible/templates/wireguard.if.j2
Normal file
6
ansible/templates/wireguard.if.j2
Normal file
@@ -0,0 +1,6 @@
|
||||
{% set _wg = lookup('vars', inventory_hostname + '_wg') %}
|
||||
# {{ ansible_managed }}
|
||||
inet {{ _wg.address }} 255.255.255.0 NONE
|
||||
up
|
||||
|
||||
!/usr/local/bin/wg setconf {{ _wg.interface }} /etc/wireguard/{{ _wg.interface }}.conf
|
||||
Reference in New Issue
Block a user