aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-12-05 17:50:43 +0100
committerbinary <me@rgoncalves.se>2020-12-05 17:50:43 +0100
commita8d06c83a539b7bb33e048272ad7001e9aaad7c4 (patch)
tree3b3c48dcfba4dff548d46099a5bab3f6489ddd74
parent031c567923cf667ad515cb5d67f088841bdf8b3d (diff)
downloadinfrastructure-a8d06c83a539b7bb33e048272ad7001e9aaad7c4.tar.gz
Migrate wireguard service in wireguard role
-rw-r--r--playbooks/network.yml9
-rw-r--r--roles/wireguard/tasks/main.yml24
2 files changed, 24 insertions, 9 deletions
diff --git a/playbooks/network.yml b/playbooks/network.yml
index 69cf59f..1e8206b 100644
--- a/playbooks/network.yml
+++ b/playbooks/network.yml
@@ -16,15 +16,6 @@
- hosts: servers
roles:
-
- - role: rc
- vars:
- rc_cmd: "{{ path_wgquick }}"
- rc_args: "up {{ global.dcontroller }}"
- rc_name: wireguard
- rc_user: "{{ user_root }}"
- ignore_errors: true
-
- { role: dns }
- { role: sshd }
diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml
index 51b97c0..5ae3a97 100644
--- a/roles/wireguard/tasks/main.yml
+++ b/roles/wireguard/tasks/main.yml
@@ -54,6 +54,30 @@
- { name: "{{ ansible_host }}", path: /etc/wireguard/dcontroller.conf }
- { name: localhost, path: "{{ wg_dir }}/{{ ansible_host }}.conf" }
+- name: enable wireguard for freebsd
+ lineinfile:
+ path: /etc/rc.conf
+ regexp: "^wireguard_enable"
+ line: wireguard_enable="YES"
+ when: os_distribution == "freebsd"
+
+- name: enable interface for freebsd
+ lineinfile:
+ path: /etc/rc.conf
+ regexp: "^wireguard_interfaces"
+ line: wireguard_interfaces="{{ global.dcontroller }}"
+ when: os_distribution == "freebsd"
+
+- name: generate and enable init script
+ include_role: name=rc
+ vars:
+ rc_cmd: "{{ path_wgquick }}"
+ rc_args: "up {{ global.dcontroller }}"
+ rc_name: wireguard
+ rc_user: "{{ user_root }}"
+ ignore_errors: true
+ when: os_distribution != "freebsd"
+
- name: generate server interface
template:
src: templates/hostname.j2
remember that computers suck.