From 5caaea2047571624575141ccccc972b0ac47e30f Mon Sep 17 00:00:00 2001 From: Tobias Richter Date: Fri, 8 Oct 2021 20:02:58 +0200 Subject: [PATCH] PVE guest and host detection (#127) * Distinguish between proxmox host and guest setup * Update CHANGELOG.md --- CHANGELOG.md | 4 +++ tasks/setup-debian-pve-guest-variant.yml | 16 +++++++++ ....yml => setup-debian-pve-host-variant.yml} | 0 tasks/setup-debian.yml | 33 ++++++++++++++----- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 tasks/setup-debian-pve-guest-variant.yml rename tasks/{setup-debian-pve-variant.yml => setup-debian-pve-host-variant.yml} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 348344a..3912e66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ SPDX-License-Identifier: GPL-3.0-or-later Changelog --------- +**8.4.0** + +- add support for installing wireguard in pve lxc guest (contribution by @tobias-richter) + **8.3.0** - add Molecule test for CentOS 7 `kernel-plus` diff --git a/tasks/setup-debian-pve-guest-variant.yml b/tasks/setup-debian-pve-guest-variant.yml new file mode 100644 index 0000000..a75626a --- /dev/null +++ b/tasks/setup-debian-pve-guest-variant.yml @@ -0,0 +1,16 @@ +--- +# Copyright (C) 2021 Tobias Richter +# 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: true + +- name: (Proxmox lxc) Install wireguard-tools. + apt: + install_recommends: no + name: + - wireguard-tools + state: present diff --git a/tasks/setup-debian-pve-variant.yml b/tasks/setup-debian-pve-host-variant.yml similarity index 100% rename from tasks/setup-debian-pve-variant.yml rename to tasks/setup-debian-pve-host-variant.yml diff --git a/tasks/setup-debian.yml b/tasks/setup-debian.yml index fb77475..1a0ddac 100644 --- a/tasks/setup-debian.yml +++ b/tasks/setup-debian.yml @@ -11,13 +11,29 @@ when: ansible_lsb.id is defined and ansible_lsb.id == "Raspbian" register: wireguard__register_raspbian_setup -- include_tasks: - file: "setup-debian-pve-variant.yml" - apply: - tags: - - wg-install - when: ansible_kernel.find("pve") != -1 - register: wireguard__register_pve_variant_setup +- name: pve variants + block: + - include_tasks: + file: "setup-debian-pve-host-variant.yml" + apply: + tags: + - wg-install + when: + - ansible_virtualization_role == "host" + register: wireguard__register_pve_host_variant_setup + + - include_tasks: + file: "setup-debian-pve-guest-variant.yml" + apply: + tags: + - wg-install + when: + - ansible_virtualization_role == "guest" + register: wireguard__register_pve_guest_variant_setup + + when: + - ansible_kernel.find("pve") != -1 + - include_tasks: file: "setup-debian-vanilla.yml" @@ -26,4 +42,5 @@ - wg-install when: - wireguard__register_raspbian_setup is skipped - - wireguard__register_pve_variant_setup is skipped + - wireguard__register_pve_guest_variant_setup is skipped + - wireguard__register_pve_host_variant_setup is skipped