summaryrefslogtreecommitdiff
path: root/roles/wireguard/base/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/wireguard/base/tasks/main.yml')
-rw-r--r--roles/wireguard/base/tasks/main.yml24
1 files changed, 24 insertions, 0 deletions
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