aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/tasks/server.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/wireguard/tasks/server.yml')
-rw-r--r--roles/wireguard/tasks/server.yml28
1 files changed, 7 insertions, 21 deletions
diff --git a/roles/wireguard/tasks/server.yml b/roles/wireguard/tasks/server.yml
index 32d52fc..9a8d67c 100644
--- a/roles/wireguard/tasks/server.yml
+++ b/roles/wireguard/tasks/server.yml
@@ -12,27 +12,13 @@
when: ansible_host == global.dcontroller
delegate_to: localhost
-- name: generate server interface
- template:
- src: templates/hostname.j2
- dest: /etc/hostname.tun0
+- name: enable wireguard interface
+ lineinfile:
+ path: /etc/rc.local
+ regexp: "^wg-quick up {{ ansible_host }}$"
+ line: "wg-quick up {{ ansible_host }}"
-# NOTE: interface destruction and creation exists in the same tasks,
-# to avoid being kicked out of the ssh sessions if this one exists
-# within the current VPN.
- name: restart wireguard interface
shell: |
- ifconfig tun0 destroy
- sleep 2
- sh /etc/netstart tun0
- register: result
-
-- name: show debug output
- debug:
- msg: |
- {% for line in result.stdout_lines %}
- "{{ line }}"
- {% endfor %}
- {% for line in result.stderr_lines %}
- "{{ line }}"
- {% endfor %}
+ wg-quick down "{{ ansible_host }}"
+ wg-quick up "{{ ansible_host }}"
remember that computers suck.