aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/wireguard/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/wireguard/tasks')
-rw-r--r--roles/wireguard/tasks/main.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml
new file mode 100644
index 0000000..2512b59
--- /dev/null
+++ b/roles/wireguard/tasks/main.yml
@@ -0,0 +1,23 @@
+- name: Set up Wireguard
+ become: true
+ block:
+ - name: Install wireguard-tools
+ ansible.builtin.apt:
+ install_recommends: false
+ name: wireguard-tools
+ state: present
+
+ - name: Config file
+ ansible.builtin.template:
+ src: wg0.conf
+ dest: '/etc/wireguard/{{ wg_name }}.conf'
+ owner: root
+ group: root
+ mode: '600'
+ register: config
+
+ - name: Restart wg-quick service
+ ansible.builtin.systemd_service:
+ name: 'wg-quick@{{ wg_name }}'
+ state: restarted
+ when: config.changed