added wg-quick restart and sudo

This commit is contained in:
2024-11-20 19:14:20 +01:00
parent 15acffab5e
commit 20469486fe

View File

@@ -1,5 +1,6 @@
- name: Setup Wireguard server
hosts: wg_server
become: yes
tasks:
- name: Install wireguard
apt:
@@ -32,7 +33,10 @@
enabled: true
handlers:
- name: read wg config
shell: "wg syncconf {{ wg_interface }} <(wg-quick strip {{ wg_interface }})"
service:
name: "wg-quick@{{ wg_interface }}"
state: restarted
# shell: "wg syncconf {{ wg_interface }} <(wg-quick strip {{ wg_interface }})"
# command: "wg setconf {{ wg_interface }} /etc/wireguard/{{ wg_interface }}.conf"
# - name: reload interface
# shell: "ifdown {{ wg_interface }}; ifup {{ wg_interface }}"
@@ -51,4 +55,4 @@
template:
src: wg_client.j2
dest: "wg_clients/wg_{{ item }}.conf"
with_items: "{{ groups['wg_clients'] | list }}"
with_items: "{{ groups['wg_clients'] | list }}"