Hi Abhijit Thanks for your reply, Only Specific VMs where the status is guestToolsNotRunning
Best Kiran On Thursday, April 9, 2020 at 1:27:18 AM UTC-7, Abhijeet Kasurde wrote: > > Hi Kiran, > > Do you want to run this operation on specific VMs or all the VMs which are > "guestToolsNotRunning" status? > > > > On Thu, Apr 9, 2020 at 12:53 PM Kiran Kumar <esxi...@gmail.com > <javascript:>> wrote: > >> Please suggest how can i add when clause in above, ie when tools status >> "guestToolsNotRunning" , power off the vm. >> >> >> - hosts: localhost >> gather_facts: false >> connection: local >> vars_files: >> - ./vars/vmware_vars.yml >> vars: >> vm_list: >> - vm1 >> tasks: >> - name: Gather VM info >> vmware_guest_info: >> hostname: "{{ vcenter_server }}" >> username: "{{ vcenter_user }}" >> password: "{{ vcenter_pass }}" >> datacenter: "{{ vcenter_datacenter }}" >> validate_certs: no >> name: "{{ item }}" >> register: vm_info >> with_items: "{{ vm_list }}" >> - name: Tools status >> debug: >> msg: "{{ vm_info.results | json_query(jmesquery) }}" >> vars: >> jmesquery: "[?instance.hw_name == '{{ item >> }}'].instance.guest_tools_status" >> with_items: "{{ vm_list }}" >> >> -- >> 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...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/efe1317e-1af2-4f6b-b82b-1dd5866d0233%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/efe1317e-1af2-4f6b-b82b-1dd5866d0233%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Thanks, > Abhijeet Kasurde > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/08ca8349-e7a3-4e84-8545-f15428f76088%40googlegroups.com.