--- - name: (Debian) Add WireGuard repository on buster apt_repository: repo: "deb http://deb.debian.org/debian buster-backports main" state: "{{ 'present' if (ansible_distribution_version | int <= 10) else 'absent' }}" update_cache: yes tags: - wg-install - name: (Debian) Get architecture command: "dpkg --print-architecture" register: wireguard__fact_dpkg_arch changed_when: False - name: (Debian) Install kernel headers to compile Wireguard with DKMS apt: name: - "linux-headers-{{ ('-cloud-' in ansible_kernel) | ternary(ansible_kernel,wireguard__fact_dpkg_arch.stdout) }}" state: present - name: (Debian) Install WireGuard packages apt: name: - "wireguard" state: present tags: - wg-install