aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inventory.yaml2
-rw-r--r--roles/wireguard/templates/wg0.conf.j24
2 files changed, 4 insertions, 2 deletions
diff --git a/inventory.yaml b/inventory.yaml
index ff5477f..03b2af7 100644
--- a/inventory.yaml
+++ b/inventory.yaml
@@ -15,3 +15,5 @@ all:
neumann:
ansible_host: neumann.box.pydis.wtf
wireguard_subnet: 10.5.0.0/16
+ vars:
+ wireguard_port: 46850
diff --git a/roles/wireguard/templates/wg0.conf.j2 b/roles/wireguard/templates/wg0.conf.j2
index 96f23c3..aabd031 100644
--- a/roles/wireguard/templates/wg0.conf.j2
+++ b/roles/wireguard/templates/wg0.conf.j2
@@ -1,7 +1,7 @@
# Configuration managed by Ansible
[Interface]
Address = {{ wireguard_subnet }}
-ListenPort = 46850
+ListenPort = {{ wireguard_port }}
PrivateKey = {{ wg_priv_key['content'] | b64decode | trim }}
{% for host in hostvars.keys() if not host == inventory_hostname %}
@@ -9,7 +9,7 @@ PrivateKey = {{ wg_priv_key['content'] | b64decode | trim }}
[Peer]
AllowedIPs = {{ hostvars[host]['wireguard_subnet'] }}
PublicKey = {{ hostvars[host]['wg_pub_key']['content'] | b64decode | trim }}
-Endpoint = {{ host }}.box.pydis.wtf:46850
+Endpoint = {{ host }}.box.pydis.wtf:{{ wireguard_port }}
PersistentKeepalive = 30
{% endfor %}