summaryrefslogtreecommitdiff
path: root/roles/wireguard/base
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-10-23 20:26:43 +0200
committerChristian Pointner <equinox@spreadspace.org>2019-10-23 20:26:43 +0200
commite654327704a926ccb292fadf47e2f184b3017771 (patch)
treeeac09cfc9389ec9a70856921e80425268da1796e /roles/wireguard/base
parentadded wireguard role for ch-mimas2 (diff)
rename wirguard role to wireguard/base
Diffstat (limited to 'roles/wireguard/base')
-rw-r--r--roles/wireguard/base/meta/main.yml4
-rw-r--r--roles/wireguard/base/tasks/main.yml24
2 files changed, 28 insertions, 0 deletions
diff --git a/roles/wireguard/base/meta/main.yml b/roles/wireguard/base/meta/main.yml
new file mode 100644
index 00000000..3542c2fa
--- /dev/null
+++ b/roles/wireguard/base/meta/main.yml
@@ -0,0 +1,4 @@
+---
+dependencies:
+- role: prepare-dkms
+- role: apt-repo/spreadspace
diff --git a/roles/wireguard/base/tasks/main.yml b/roles/wireguard/base/tasks/main.yml
new file mode 100644
index 00000000..11761c33
--- /dev/null
+++ b/roles/wireguard/base/tasks/main.yml
@@ -0,0 +1,24 @@
+---
+- name: install wireguard packages
+ apt:
+ name:
+ - wireguard-dkms
+ - wireguard-tools
+ state: present
+
+- name: check if module is available for the currently running kernel
+ command: modprobe --dry-run wireguard
+ check_mode: no
+ register: wireguard_module_available
+ failed_when: false
+ changed_when: false
+
+- name: rebuild wireguard module
+ when: wireguard_module_available.rc != 0
+ command: dpkg-reconfigure wireguard-dkms
+
+- name: check again if module is available for the currently running kernel
+ when: wireguard_module_available.rc != 0
+ command: modprobe --dry-run wireguard
+ check_mode: no
+ changed_when: false