summaryrefslogtreecommitdiff
path: root/roles/wireguard/tasks/main.yml
blob: a9d42b7b2dfac65b80c1a319e76834c80665e9ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: install wireguard packages
  apt:
    name: "{{ item }}"
    state: present
  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