diff --git a/molecule/kvm/converge.yml b/molecule/kvm/converge.yml index 15e9d84..44ee210 100644 --- a/molecule/kvm/converge.yml +++ b/molecule/kvm/converge.yml @@ -15,6 +15,13 @@ ignore_errors: true when: ansible_distribution|lower == 'archlinux' + - name: (Proxmox) Delete /var/lib/apt/lists/lock + file: + name: /var/lib/apt/lists/lock + state: absent + ignore_errors: true + when: ansible_kernel.find("pve") != -1 + - name: Include WireGuard role include_role: name: githubixx.ansible_role_wireguard diff --git a/molecule/kvm/molecule.yml b/molecule/kvm/molecule.yml index 820abf5..3829cd4 100644 --- a/molecule/kvm/molecule.yml +++ b/molecule/kvm/molecule.yml @@ -97,6 +97,15 @@ platforms: ip: 192.168.10.90 groups: - vpn + - name: test-wg-proxmox + box: rantanevich/proxmox + interfaces: + - auto_config: true + network_name: private_network + type: static + ip: 192.168.10.100 + groups: + - vpn provisioner: name: ansible @@ -155,6 +164,11 @@ provisioner: wireguard_port: 51820 wireguard_persistent_keepalive: "30" wireguard_endpoint: "192.168.10.90" + test-wg-proxmox: + wireguard_address: "10.10.10.100/24" + wireguard_port: 51820 + wireguard_persistent_keepalive: "30" + wireguard_endpoint: "192.168.10.100" scenario: name: kvm diff --git a/tasks/setup-debian-pve-variant.yml b/tasks/setup-debian-pve-variant.yml new file mode 100644 index 0000000..de5c6a2 --- /dev/null +++ b/tasks/setup-debian-pve-variant.yml @@ -0,0 +1,27 @@ +--- +# Copyright (C) 2018-2020 Robert Wimmer +# Copyright (C) 2019-2020 Ties de Kock +# Copyright (C) 2021 Steve Fan +# SPDX-License-Identifier: GPL-3.0-or-later + +- name: (Proxmox) Add WireGuard repository + 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: (Proxmox) Install kernel headers for the currently running kernel to compile WireGuard with DKMS + apt: + name: + - "pve-headers-{{ ansible_kernel }}" + state: present + +- name: (Proxmox) Install WireGuard packages + apt: + name: + - "wireguard" + state: present + tags: + - wg-install diff --git a/tasks/setup-debian.yml b/tasks/setup-debian.yml index 89a9217..da69b2b 100644 --- a/tasks/setup-debian.yml +++ b/tasks/setup-debian.yml @@ -1,10 +1,17 @@ --- # Copyright (C) 2020 Stefan Haun +# Copyright (C) 2021 Steve Fan # SPDX-License-Identifier: GPL-3.0-or-later - include_tasks: "setup-debian-raspbian.yml" - when: ansible_lsb.id == "Raspbian" + when: ansible_lsb.id is defined and ansible_lsb.id == "Raspbian" register: wireguard__register_raspbian_setup +- include_tasks: "setup-debian-pve-variant.yml" + when: ansible_kernel.find("pve") != -1 + register: wireguard__register_pve_variant_setup + - include_tasks: "setup-debian-vanilla.yml" - when: wireguard__register_raspbian_setup is skipped + when: + - wireguard__register_raspbian_setup is skipped + - wireguard__register_pve_variant_setup is skipped