summaryrefslogtreecommitdiff
path: root/roles/install_wg_add
diff options
context:
space:
mode:
Diffstat (limited to 'roles/install_wg_add')
-rw-r--r--roles/install_wg_add/tasks/main.yml30
-rw-r--r--roles/install_wg_add/templates/wg_add.service.j210
2 files changed, 40 insertions, 0 deletions
diff --git a/roles/install_wg_add/tasks/main.yml b/roles/install_wg_add/tasks/main.yml
new file mode 100644
index 0000000..da7f0b4
--- /dev/null
+++ b/roles/install_wg_add/tasks/main.yml
@@ -0,0 +1,30 @@
+---
+- name: install wg_add dependencies
+ pacman:
+ name:
+ - git
+ - make
+ - gcc
+ state: present
+
+- name: clone wg_add repo
+ git:
+ repo: https://github.com/FreifunkMYK/wg_add.git
+ dest: /opt/wg_add
+
+- name: build wg_add
+ make:
+ chdir: /opt/wg_add
+
+- name: install wg_add service
+ template:
+ src: wg_add.service.j2
+ dest: /etc/systemd/system/wg_add@.service
+ mode: 0644
+
+- name: start and enable wgkex service
+ systemd:
+ name: wg_add@{{ item.name }}
+ state: started
+ enabled: yes
+ with_items: "{{ sites }}"
diff --git a/roles/install_wg_add/templates/wg_add.service.j2 b/roles/install_wg_add/templates/wg_add.service.j2
new file mode 100644
index 0000000..b348e98
--- /dev/null
+++ b/roles/install_wg_add/templates/wg_add.service.j2
@@ -0,0 +1,10 @@
+[Unit]
+Description=wg_add
+After=network.target
+
+[Service]
+ExecStart=/opt/wg_add/wg_add {{ ansible_default_ipv4.interface }} wg%i vx%i
+Restart=always
+
+[Install]
+WantedBy=multi-user.target