i’ve got a dynamic vmware inventory in Ansible:
---
plugin: vmware_vm_inventory
strict: False
hostname: vsphere.customer.local
username: '{{ vsphere_user }}'
password: '{{ vsphere_password }}'
validate_certs: False
with_tags: True
groups:
linux: "('linux' in tag_category.Ansible)"
windows: "('windows' in tag_category.Ansible)"
all_vms: "('true' in VMs) and ('true' not in config.template) and ('vCLS' not in config.name)"
compose:
ansible_host: >-
guest.net
| selectattr('ipAddress')
| map(attribute='ipAddress')
| flatten
| select('match', '^10.0.10.*')
| list
| first
properties:
- 'guest.net'
- 'config'
Basically everything is working except for the new group i’ve created:
all_vms: “(‘true’ in VMs) and (‘true’ not in config.template) and (‘vCLS’ not in config.name)”
What i want is a group that includes the hosts from
group:
VMs: true
and excludes all templetes (config.template = false) and exludes all vCLS hosts (config.name != vCLS*)
I tried this aswell
all_vms: "all and ('true' not in config.template) and ('vCLS' not in config.name)"
I think it’s possible, since i got a similar filter in an Azure dynamic inventory, but here the group is just empty (not showing up at all).
user24663471 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.