--- - name: Query Proxmox for existing LXCs community.proxmox.proxmox_vm_info: type: lxc register: proxmox_lxcs - name: Check if LXC already exists ansible.builtin.set_fact: lxc_exists: >- {{ (lxc_vmid is defined and lxc_vmid | int in (proxmox_lxcs.proxmox_vms | map(attribute='vmid') | list)) or (lxc_hostname is defined and (proxmox_lxcs.proxmox_vms | selectattr('name', 'equalto', lxc_hostname) | list | length > 0)) }}