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 (<esxi1...@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-project+unsubscr...@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/CAFtje5NwXiyu9df3bEACRNy3F8iwigc7pPjZm6WE_-UXXqi9Pg%40mail.gmail.com.

Reply via email to