Refactor default wireguard setup
- Replaced set_fact based setup with lookup plugin - Replaced inline definition of credentials with alternative systemd file directives
This commit is contained in:
parent
02ed21405f
commit
a777228013
4 changed files with 19 additions and 35 deletions
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
[Interface]
|
||||
Address={{ vpn_peers.mobile.ip }}/24
|
||||
PrivateKey={{ vpn_peers.mobile.private_key }}
|
||||
PrivateKey={{ lookup("file", vpn_peers.mobile.private_key_source_path) }}
|
||||
|
||||
[Peer]
|
||||
PublicKey={{ vpn_server_public_key }}
|
||||
PresharedKey={{ vpn_peers.mobile.preshared_key }}
|
||||
PublicKey={{ lookup("file", vpn_server_public_key_path) }}
|
||||
PresharedKey={{ lookup("file", vpn_peers.mobile.preshared_key_path) }}
|
||||
AllowedIPs={{ vpn_listen_address }}/32
|
||||
Endpoint={{ domain_name }}:{{ vpn_port }}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ Description=WireGuard tunnel wg0
|
|||
|
||||
[WireGuard]
|
||||
ListenPort={{ vpn_port }}
|
||||
PrivateKey={{ vpn_server_key }}
|
||||
PrivateKeyFile={{ vpn_server_key_path }}
|
||||
|
||||
{% for peer, properties in vpn_peers.items() %}
|
||||
[WireGuardPeer]
|
||||
PublicKey={{ properties.public_key }}
|
||||
PresharedKey={{ properties.preshared_key }}
|
||||
PresharedKeyFile={{ properties.preshared_key_path }}
|
||||
AllowedIPs={{ properties.ip }}/32
|
||||
{% if not loop.last %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue