Hi 


I am using vmware_vm_shell module as below to execute commands in VMs in 
ESXI hosts . if it is a matter of 2 or 3 esxi servers , it is easier to 
prepare a yaml list or dictionary as a vars file and use it in the module . 
What if there are 100 ESXI hosts and 300+ VMs to execute any command . Is 
there a way to convert a comma seperated file to a nice yaml list or 
dictionary ?

vmware_vm_shell:
  hostname: "{{item.key}}"
  username: blahxxxx
  password: blahxxxx
  validate_certs: no
  vm_id: "{{item.value.name}}"
  vm_username: blahxxx
  vm_password: blahxxxx
  vm_shell: /bin/touch
  vm_shell_args: "touch /tmp/{{item.value.ip_address}}.txt"
  #vm_shell_cwd: "/tmp"
with_dict: "{{values}}"
#delegate_to: localhost

My vars.yml file used for above play is as below for 2 esxi servers
------------------------------

values:
<esx1>:
name: random
ip_address: 10.xx.yy.zz
<esx2>:
name: abc
ip_address: 10.xx.xx.xx


Say for example my input file is in the below format . Imagine it to run 
for like 500+ lines with esx,vm_name and ip address values
esx1,random,10.xx.yy.zz
esx2,abc,10.xx.xx.xx


Is there a way to convert above file into a yaml dict so that I can use it 
in my module? Is there any jina2 filter I can use for the same . 


Thanks

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/863976be-e8f4-4d80-bdb0-5e274d9447a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to