parent
9e172580bc
commit
7e62efcbb9
@ -1,2 +1,5 @@
|
||||
---
|
||||
# defaults file for wg_vpn
|
||||
|
||||
wireguard_server_listen_port: 51820
|
||||
|
||||
wireguard_server_lan_interface: enp3s0
|
||||
|
@ -1,2 +1,5 @@
|
||||
---
|
||||
# handlers file for wg_vpn
|
||||
# handlers file for wg_vpn
|
||||
|
||||
- name: restart wireguard
|
||||
service: name=wg-quick@wg0.service state=restarted
|
||||
|
@ -0,0 +1,30 @@
|
||||
[Interface]
|
||||
PrivateKey = {{ wireguard_server_privkey }}
|
||||
{#
|
||||
We want the Address field here to be an IP address
|
||||
with the whole network in CIDR notation, like 10.0.0.1/24.
|
||||
|
||||
If wireguard_vpn_network is a CIDR network like 10.0.0.0/24,
|
||||
and wireguard_server_offset is an integer like 1,
|
||||
this will produce an offset of the start of the network + CIDR prefix,
|
||||
which in this case will be the desired 10.0.0.1/24.
|
||||
#}
|
||||
Address = {{ wireguard_vpn_network | ipaddr(wireguard_server_offset) }}
|
||||
ListenPort = {{ wireguard_server_listen_port }}
|
||||
|
||||
{% for client in wireguard_clients %}
|
||||
[Peer]
|
||||
# {{ client.name }}
|
||||
PublicKey = {{ client.pubkey }}
|
||||
{#
|
||||
We want the Address field here to be an IP address
|
||||
withOUT the whole network in CIDR notation, like 10.0.0.15/32.
|
||||
|
||||
If wireguard_vpn_network is a CIDR network like 10.0.0.0/24,
|
||||
and client.offset is an integer like 15,
|
||||
this will produce an offset of the start of the network with a /32 CIDR prefix
|
||||
which in this case will be the desired 10.0.0.15/32.
|
||||
#}
|
||||
AllowedIPs = {{ wireguard_vpn_network | ipsubnet(32, client.offset) }}
|
||||
|
||||
{% endfor %}
|
Loading…
Reference in new issue