# specify a host in each task.

**URL:** <https://forum.ansible.com/t/specify-a-host-in-each-task/34220>\
**Category:** Ansible Project\
**Created:** [November 21, 2020, 8:32am UTC](https://forum.ansible.com/t/specify-a-host-in-each-task/34220 "2020-11-21T08:32:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blue\_fox](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@blue\_fox](https://forum.ansible.com/u/blue_fox)\
**Post date:** [November 21, 2020, 8:32am UTC](https://forum.ansible.com/t/specify-a-host-in-each-task/34220/1 "2020-11-21T08:32:39Z")

</div>

Hello ,

how I can specify a host in each task.

Thank you

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 21, 2020, 10:23am UTC](https://forum.ansible.com/t/specify-a-host-in-each-task/34220/2 "2020-11-21T10:23:12Z")

</div>

Please explain a bit more why what etc  
And share a playbook

---

<div class="post-metadata">

**Author:** ![Roberto\_J\_R\_Paz](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@Roberto\_J\_R\_Paz](https://forum.ansible.com/u/Roberto_J_R_Paz)\
**Post date:** [November 21, 2020, 3:54pm UTC](https://forum.ansible.com/t/specify-a-host-in-each-task/34220/3 "2020-11-21T15:54:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blue\_fox](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@blue\_fox](https://forum.ansible.com/u/blue_fox)\
**Post date:** [November 22, 2020, 1:56am UTC](https://forum.ansible.com/t/specify-a-host-in-each-task/34220/4 "2020-11-22T01:56:05Z")

</div>

he working 🙂  
Thank you
