From 6255b78e927f5e4c4aa96baafd1df2b000efe1d5 Mon Sep 17 00:00:00 2001 From: adubreuiltk <5410883+adubreuiltk@users.noreply.github.com> Date: Sat, 31 Aug 2019 11:10:23 +0200 Subject: [PATCH] Filter on qemu and lxc resources only # SUMMARY When using proxmox.py as a dynamic inventory for Ansible, only VM and lxc must be included in the output. Other resources such as datastores must be excluded. # ISSUE TYPE Bugfix Pull Request # ADDITIONAL INFORMATION If a datastore is defined in a pool, the script crashes as the parameter template does not apply to datastore objects. # VERSION PVE 5.4.13 --- proxmox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox.py b/proxmox.py index 9cd41e0..0c87d21 100755 --- a/proxmox.py +++ b/proxmox.py @@ -91,7 +91,7 @@ class ProxmoxVersion(dict): class ProxmoxPool(dict): def get_members_name(self): - return [member['name'] for member in self['members'] if member['template'] != 1] + return [member['name'] for member in self['members'] if (member['type'] == 'qemu' or member['type'] == 'lxc') and member['template'] != 1] class ProxmoxAPI(object):