This commit is contained in:
Michael Grote 2024-02-15 09:48:28 +01:00 committed by mg
parent dda0d457e1
commit 6db5b9d2b8
3 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,11 @@
---
wireguard_conf_dir: /etc/wireguard
#wireguard_profiles:
# - name: wg0
# privatekey:
# address:
# dns:
# publickey:
# allowedips:
# endpoint:
...

View file

@ -0,0 +1,20 @@
---
- name: Ensure package exists
become: true
ansible.builtin.package:
name:
- wireguard
state: present
- name: Ensure profiles are templated
become: true
ansible.builtin.template:
src: "wg.conf.j2"
dest: "{{ wireguard_conf_dir }}/{{ item.name }}.conf"
owner: root
group: root
mode: "0600"
when:
- wireguard_profiles is defined
loop: wireguard_profiles
...

View file

@ -0,0 +1,10 @@
[Interface]
PrivateKey = {{ privatekey }}
Address = {{ address }}
DNS = {{ dns }}
[Peer]
PublicKey = {{ publickey }}
AllowedIPs = {{ allowedips }}
Endpoint = {{ endpoint }}
PersistentKeepalive = 25