From 46a93405ae967a779855c7f11272c42be6abdbec Mon Sep 17 00:00:00 2001 From: "iliya.saroukha" <iliya.saroukhanian@etu.hesge.ch> Date: Sun, 16 Mar 2025 20:36:37 +0100 Subject: [PATCH] feat: wireguard jinja templ --- playbooks/templates/wireguard.j2 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 playbooks/templates/wireguard.j2 diff --git a/playbooks/templates/wireguard.j2 b/playbooks/templates/wireguard.j2 new file mode 100644 index 0000000..8bc8efe --- /dev/null +++ b/playbooks/templates/wireguard.j2 @@ -0,0 +1,15 @@ +[Interface] +Address = {{ interfaces[inventory_hostname]["wg0"].address }} +PrivateKey = {{ keys[inventory_hostname]["private"].key }} +ListenPort = {{ interfaces[inventory_hostname]["wg0"].port }} + +[Peer] +{% if inventory_hostname == "H1" %} +PublicKey = {{ keys["H2"]["public"].key }} +AllowedIPs = {{ interfaces["H2"]["wg0"].address }}/32 +Endpoint = {{ interfaces["H2"]["eth0"].address }}:{{ interfaces["H2"]["wg0"].port }} +{% else %} +PublicKey = {{ keys["H1"]["public"].key }} +AllowedIPs = {{ interfaces["H1"]["wg0"].address }}/32 +Endpoint = {{ interfaces["H1"]["eth0"].address }}:{{ interfaces["H1"]["wg0"].port }} +{% endif %} -- GitLab