Use list of all peers
This commit is contained in:
parent
8ba1bd81d6
commit
708a29ed99
2 changed files with 13 additions and 8 deletions
|
@ -7,8 +7,9 @@
|
|||
- Restart Wireguard service
|
||||
|
||||
- name: Register private key
|
||||
shell: cat /etc/wireguard/privatekey
|
||||
register: privatekey
|
||||
slurp:
|
||||
src: /etc/wireguard/privatekey
|
||||
register: private_key
|
||||
|
||||
- name: Ensure Wireguard client is configure
|
||||
template:
|
||||
|
@ -35,4 +36,4 @@
|
|||
name: Ping VPN server
|
||||
job: ping -c 3 192.168.2.1 &> /dev/null
|
||||
hour: '1'
|
||||
user: gestor
|
||||
user: gestor
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
[Interface]
|
||||
Address = {{ addresses[ansible_hostname] }}
|
||||
PrivateKey = {{ privatekey.stdout }}
|
||||
PrivateKey = {{ private_key }}
|
||||
ListenPort = {{ listenport }}
|
||||
|
||||
# Server:
|
||||
{% for item in wireguard_peers %}
|
||||
|
||||
# Peer name: {{ item.name }}
|
||||
[Peer]
|
||||
PublicKey = {{ server_publickey }}
|
||||
AllowedIPs = {{ allowed_ips }}
|
||||
EndPoint = {{ endpoint }}
|
||||
PublicKey = {{ item.PublicKey }}
|
||||
AllowedIPs = {{ item.AllowedIPs }}
|
||||
{% if item.EndPointIP is defined and item.EndPointIP != '' %}
|
||||
EndPoint = {{ item.EndPointIP }}:{{ listenport }}
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue