From c76e31d8d9bf411553643bf4dc29b2b34dc8e997 Mon Sep 17 00:00:00 2001 From: maynero Date: Sun, 9 May 2021 16:13:16 +0800 Subject: [PATCH] Create group base on OS --- proxmox.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxmox.py b/proxmox.py index 7e9cb1a..f7bd814 100755 --- a/proxmox.py +++ b/proxmox.py @@ -367,6 +367,14 @@ def main_list(options, config_path): } results['running']['hosts'] += [vm] + if 'proxmox_os_id' in results['_meta']['hostvars'][vm]: + osid = results['_meta']['hostvars'][vm]['proxmox_os_id'] + if osid not in results: + results[osid] = { + 'hosts': [] + } + results[osid]['hosts'] += [vm] + results['_meta']['hostvars'][vm].update(metadata) # pools