summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--roles/wireguard/tasks/main.yml17
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml
index 3dc63e64..a9d42b7b 100644
--- a/roles/wireguard/tasks/main.yml
+++ b/roles/wireguard/tasks/main.yml
@@ -6,3 +6,20 @@
with_items:
- wireguard-dkms
- wireguard-tools
+
+- 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