diff --git a/changelogs/fragments/6640-proxmox-composite-variables-support.yml b/changelogs/fragments/6640-proxmox-composite-variables-support.yml new file mode 100644 index 0000000000..bce33c01ba --- /dev/null +++ b/changelogs/fragments/6640-proxmox-composite-variables-support.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - proxmox inventory plugin - add composite variables support for Proxmox nodes (https://github.com/ansible-collections/community.general/issues/6640). diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py index 1389f9ee26..d0053afbd7 100644 --- a/plugins/inventory/proxmox.py +++ b/plugins/inventory/proxmox.py @@ -590,6 +590,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): ip = self._get_node_ip(node['node']) self.inventory.set_variable(node['node'], 'ansible_host', ip) + # Setting composite variables + variables = self.inventory.get_host(node['node']).get_vars() + self._set_composite_vars(self.get_option('compose'), variables, node['node'], strict=self.strict) + # add LXC/Qemu groups for the node for ittype in ('lxc', 'qemu'): node_type_group = self._group('%s_%s' % (node['node'], ittype))