set up role for wireguard connections
This commit is contained in:
parent
39a531cf87
commit
6c77886916
9 changed files with 137 additions and 0 deletions
16
roles/any.tools.wireguard/templates/wg0.conf.j2
Normal file
16
roles/any.tools.wireguard/templates/wg0.conf.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[Interface]
|
||||
Address = {{ wireguard_address }}
|
||||
PrivateKey = {{ wireguard_private_key }}
|
||||
ListenPort = {{ wireguard_port }}
|
||||
|
||||
{% for host in wireguard_peers %}
|
||||
{% if host != inventory_hostname %}
|
||||
[Peer]
|
||||
# {{ host }}
|
||||
PublicKey = {{ hostvars[host]['wireguard_public_key'] }}
|
||||
AllowedIPs = {{ hostvars[host]['wireguard_address'].split('/')[0] }}/32
|
||||
Endpoint = {{ hostvars[host]['ansible_host'] | default(host) }}:{{ hostvars[host]['wireguard_port'] | default(wireguard_port) }}
|
||||
PersistentKeepalive = {{ wireguard_keepalive }}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue