From 70117bbf9ac410be9d77e4abfb5c0e8e14c763b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 7 Aug 2022 22:37:17 +0200 Subject: [PATCH] Check whether a VM should be managed --- inventory/03-check-managed.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 inventory/03-check-managed.yml diff --git a/inventory/03-check-managed.yml b/inventory/03-check-managed.yml new file mode 100644 index 0000000..8a9e64e --- /dev/null +++ b/inventory/03-check-managed.yml @@ -0,0 +1,12 @@ +# Create the _inv__managed variable, containing an empty string, if and only +# if the metadata contains what we want AND the VM is connected to the network. +plugin: constructed +strict: false + +compose: + _inv__managed: >- + ( inv__instance and inv__service ) | ternary( '' , '' ) + }}{% if proxmox__net0.link_down | default("0") == "1" + %}{{ this_variable_does_not_exist_and_so_inv_managed_will_not_be_created + }}{% endif + %}{{ ''