# delegate\_to in loop: only connecting to first host in list

**URL:** <https://forum.ansible.com/t/delegate-to-in-loop-only-connecting-to-first-host-in-list/20220>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [January 14, 2016, 8:54pm UTC](https://forum.ansible.com/t/delegate-to-in-loop-only-connecting-to-first-host-in-list/20220 "2016-01-14T20:54:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvlin.uy](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@alvlin.uy](https://forum.ansible.com/u/alvlin.uy)\
**Post date:** [January 14, 2016, 8:54pm UTC](https://forum.ansible.com/t/delegate-to-in-loop-only-connecting-to-first-host-in-list/20220/1 "2016-01-14T20:54:59Z")

</div>

Hi (again!)

Found another unexpected issue with my code.  
I’m trying to automate the deployment of an application which consists of some java processes in Linux servers, and then a GUI client running on Windows. So, I’m using a delegated task to clear some cached files in the Windows servers when I change the app version in the backend.

I’ve simplified the problem I’m seeing into the following play:

`

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 14, 2016, 11:09pm UTC](https://forum.ansible.com/t/delegate-to-in-loop-only-connecting-to-first-host-in-list/20220/2 "2016-01-14T23:09:34Z")

</div>

open bug, it seems that delegation uses the connection data of the  
first host delegated to  
[https://github.com/ansible/ansible/issues/13880](https://github.com/ansible/ansible/issues/13880)

---

<div class="post-metadata">

**Author:** ![Florin\_Andrei](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@Florin\_Andrei](https://forum.ansible.com/u/Florin_Andrei)\
**Post date:** [March 4, 2016, 9:33pm UTC](https://forum.ansible.com/t/delegate-to-in-loop-only-connecting-to-first-host-in-list/20220/3 "2016-03-04T21:33:54Z")

</div>

I just hit this exact same bug with ansible-2.0.1.0. The bug report was submitted for ansible-2.0.0.0. My use case is same as the original report - enabling/disabling backend servers via the haproxy module.

The ticket says: “We believe the above commit should resolve this problem for you. This will also be included in the next major release.”

What is the “next major release” that is supposed to fix this bug?
