From 178209be27ee78b82261d488db55125acd8ec140 Mon Sep 17 00:00:00 2001 From: Jeffrey van Pelt Date: Fri, 12 Mar 2021 08:00:03 +0100 Subject: [PATCH] Excluded qemu templates in pools (#1991) * Excluded qemu templates in pools * Added changelog fragment * Made check more robust --- .../fragments/1991-proxmox-inventory-fix-template-in-pool.yml | 3 +++ plugins/inventory/proxmox.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1991-proxmox-inventory-fix-template-in-pool.yml diff --git a/changelogs/fragments/1991-proxmox-inventory-fix-template-in-pool.yml b/changelogs/fragments/1991-proxmox-inventory-fix-template-in-pool.yml new file mode 100644 index 0000000000..90a438dddf --- /dev/null +++ b/changelogs/fragments/1991-proxmox-inventory-fix-template-in-pool.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - proxmox inventory - exclude qemu templates from inclusion to the inventory via pools (https://github.com/ansible-collections/community.general/issues/1986, https://github.com/ansible-collections/community.general/pull/1991). diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index bc79d596cb..d69775baf6 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -349,7 +349,8 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): for member in self._get_members_per_pool(pool['poolid']): if member.get('name'): - self.inventory.add_child(pool_group, member['name']) + if not member.get('template'): + self.inventory.add_child(pool_group, member['name']) def parse(self, inventory, loader, path, cache=True): if not HAS_REQUESTS: