I didn't tested, but maybe adding somethine like this?

- lineinfile:
      path: path_to_localLogfile
      insertafter: EOF
      line:  '{{ vm_IP }}'  
      *create*: yes
   delegate_to: localhost

(Assuming you want to save the info stored in '{{ vm_IP }}' to a localfile
El sábado, 21 de noviembre de 2020 a la(s) 06:37:56 UTC-6, 
[email protected] escribió:

> i want to copy ip address of VM in local file (localhost)
>
> - hosts: localhost
>
>   gather_facts: false
>
>   vars_files:
>
>     - vars.yml
>
>   tasks:
>
>     - name: provisioning vm
>
>       vmware_guest:
>
>         hostname: '{{ vsphere_hostname }}'
>
>         username: '{{ vsphere_username }}'
>
>         password: '{{ vsphere_password }}'
>
>         validate_certs: no
>
>         datacenter: '{{ vsphere_datacenter }}'
>
>         cluster: '{{ vsphere_cluster }}'
>
>         folder: '{{ vsphere_folder }}'
>
>         name: "{{ inventory_hostname }}"
>
>         state: poweredon
>
>         guest_id: '{{ vm_id }}'
>
>         template: '{{ vm_template }}'
>
>         networks:
>
>         - name: '{{ vm_network_US }}'
>
>           ip: '{{ vm_IP }}'
>
>           netmask: '{{ vm_netmask}}'
>
>           gateway: '{{ vm_gateway}}'
>
>           dns_servers: '{{ vm_dns }}'
>
>           start_connected: yes
>
>           connected: yes
>
>         wait_for_ip_address: yes
>
>         state: poweredon
>
>       delegate_to: localhost
>
>       register: vm
>
>
>
>  
> Le samedi 21 novembre 2020 à 11:23:49 UTC+1, [email protected] a écrit :
>
>> Please explain a bit more why what etc
>> And share a playbook 
>>
>> On Sat, 21 Nov 2020 at 09:32, blue fox <[email protected]> wrote:
>>
>>> Hello ,
>>>
>>> how I can specify a host in each task.
>>>
>>> Thank you
>>>
>>> -- 
>>> 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/98965131-1426-4e91-8537-01bdee198e4bn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/ansible-project/98965131-1426-4e91-8537-01bdee198e4bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> Sent from a mobile device - please excuse the brevity, spelling and 
>> punctuation.
>>
>

-- 
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/a4cfdfa6-9c66-4789-ae9f-3f6e2af5c600n%40googlegroups.com.

Reply via email to