Plybook with community.vmware modules & inventory item issue

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 )

You should modify your hosts entry to point to inventory vms and delegate to localhost vmware tasks.

Hope that helps,

Regards

Thanks for the reply … So you mean change below

Yep, that should do the trick.

Thanks Again

Is below possible in this case :-

Section called New-VM-Section has many servers

But i would like playbook task of patching only on specific vm ?

eg

[ New-VM-Section]
vm1
vm2
vm3

And the playbook below to run only on say vm3 & not entire section called New-VM-Section

  • hosts: New-VM-Section
    gather_facts: false


yum:…

I know below

To exclude host1 and host2 from execution and allow execution only in host3:

$ ansible-playbook --limit ‘!hoost1:!host2:host3’ yourPlaybook.yml

Is there way to rather “include” only 1 …

Also how to add this in playbook itself

Any suggestions Please

Found this https://stackoverflow.com/questions/18195142/safely-limiting-ansible-playbooks-to-a-single-machine

So folks saying better use -e of ansible-playbook