I am getting vms from vcenter using vmware inventory plugin. The vms are 
mix of windows and linux. I want to assign ansible_connection: ssh if the 
vm is linux and ansible_connection: winrm if windows. Using compose as 
below assign ansible_connection: ssh to all vms irresptive if they are 
linux or windows:

plugin: community.vmware.vmware_vm_inventory strict: False hostname: 
10.65.223.31 username: [email protected] password: xxxxxx 
validate_certs: False
filters: - guest.guestId is match('rhel*') or guest.guestId is 
match('windows*') compose: ansible_host: 'guest.ipAddress' composed_var: 
'config.name' # This will populate a host variable with a string value 
ansible_user: "'admin'" ansible_connection: "'ssh'" groups: VMs: True 
hostnames: - config.name

How do I assign different vars based on OS or group names?


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bd354ed3-161e-4fe3-a04c-2bf4423c2c0en%40googlegroups.com.

Reply via email to