Assign different variables to each server from vmware dynamic inventory
115 views
Skip to first unread message
Eshtehar Khan
unread,
Jan 23, 2022, 2:13:10 PM1/23/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
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:
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 valueansible_user: "'admin'"
ansible_connection: "'ssh'"
groups:VMs: True
hostnames:-config.name
How do I assign different vars based on OS or group names?