From c1c300aa21b407351e6045c7b40480d4120db8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Fri, 10 Dec 2021 18:30:32 +0000 Subject: roles: Generate + deploy wireguard configurations --- roles/wireguard/tasks/service.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 roles/wireguard/tasks/service.yml (limited to 'roles/wireguard/tasks/service.yml') diff --git a/roles/wireguard/tasks/service.yml b/roles/wireguard/tasks/service.yml new file mode 100644 index 0000000..d1a1007 --- /dev/null +++ b/roles/wireguard/tasks/service.yml @@ -0,0 +1,20 @@ +- name: enable wireguard interface for OpenBSD + lineinfile: + path: /etc/rc.local + regexp: "^/usr/local/bin/wg-quick up {{ wireguard_domain_controller }}$" + line: "/usr/local/bin/wg-quick up {{ wireguard_domain_controller }}" + owner: 0 + owner: 0 + create: true + mode: 0644 + when: ansible_distribution == "OpenBSD" + +- name: restart wireguard interface + command: wg-quick "{{ item }}" "{{ wireguard_domain_controller }}" + ignore_errors: true + loop: + - down + - up + loop_control: + pause: 5 + when: ansible_distribution == "OpenBSD" -- cgit v1.2.3