Thanks for the reply .. So you mean change below 

---
- hosts: localhost
  gather_facts: false
  connection: local 

to 

---
- hosts: New-VM-Section
  gather_facts: false
  connection: local 

AND 

add in task below 

- name: Update tags  &   - name: Reboot the VM 
..
..
delegate_to: localhost





On Saturday, March 6, 2021 at 5:06:48 AM UTC-8 jruar...@gmail.com wrote:

> You should modify your hosts entry to point to inventory vms and delegate 
> to localhost vmware tasks.
>
> Hope that helps,
>
> Regards
>
>
>
>  
>
> El sáb, 6 mar 2021 a las 8:54, esxi...@gmail.com (<esxi...@gmail.com>) 
> escribió:
>
>> Hi
>>
>> I am using community.vmware related modules in a playbook .. which 
>> updates tags & reboot vms
>>
>> In the same vm i would like to patch the VM
>>
>> Below is the code .. but the yum module here seems not acting on the 
>> target ie "{{ vm_name }" but does not the ansible control node itself 
>>
>> Any suggestions Please ( My requirement is not to use separate playbook ) 
>>
>> ---
>> - hosts: localhost
>>   gather_facts: false
>>   connection: local
>>   vars_files:
>>     - /etc/ansible/playbooks/vm-provision/vars/vc.yml
>>   tasks:
>>     - name: Update tags
>>       community.vmware.vmware_guest_custom_attributes:
>>         hostname: "{{ vcenter_server }}"
>>         username: "{{ vcenter_username }}"
>>         password: "{{ vcenter_password }}"
>>         validate_certs: no
>>         name: "{{ vm_name }"
>>         state: present
>>         attributes:
>>           - name: OS
>>             value: "{{ vcenter_OS }}"
>>           - name: Location
>>             value: "{{ vcenter_Location }}"
>>     - name: upgrade all packages 
>>       yum: name=* state=latest 
>>       
>>     - name: Reboot the VM
>>       community.vmware.vmware_guest_powerstate:
>>         hostname: "{{ vcenter_server }}"
>>         username: "{{ vcenter_username }}"
>>         password: "{{ vcenter_password }}"
>>         validate_certs: no
>>         folder: "{{ vcenter_folder }}"
>>         name: "{{ vm_name }"
>>         state: reboot-guest
>>
>> Thanks
>> Kiran
>>
>> -- 
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/45726bf6-d0df-4b05-bc4a-6a33358f92een%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/45726bf6-d0df-4b05-bc4a-6a33358f92een%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/d745dc04-49c2-45b7-933f-71c0dc7f7558n%40googlegroups.com.

Reply via email to