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 










On Saturday, March 6, 2021 at 12:27:57 PM UTC-8 [email protected] wrote:

> Yep, that should do the trick.
>
> El sáb, 6 mar 2021 a las 21:20, [email protected] (<[email protected]>) 
> escribió:
>
>> 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 [email protected] 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, [email protected] (<[email protected]>) 
>>> 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 [email protected].
>>>> 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 [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d745dc04-49c2-45b7-933f-71c0dc7f7558n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/d745dc04-49c2-45b7-933f-71c0dc7f7558n%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2259b51f-f465-4ff9-a0bc-2f7947bfa144n%40googlegroups.com.

Reply via email to