# delegate\_to and with\_items together: only the first item is executed/looped

**URL:** <https://forum.ansible.com/t/delegate-to-and-with-items-together-only-the-first-item-is-executed-looped/20387>\
**Category:** Ansible Developer\
**Created:** [January 29, 2016, 6:15pm UTC](https://forum.ansible.com/t/delegate-to-and-with-items-together-only-the-first-item-is-executed-looped/20387 "2016-01-29T18:15:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henri\_Volotinen](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@Henri\_Volotinen](https://forum.ansible.com/u/Henri_Volotinen)\
**Post date:** [January 29, 2016, 6:15pm UTC](https://forum.ansible.com/t/delegate-to-and-with-items-together-only-the-first-item-is-executed-looped/20387/1 "2016-01-29T18:15:13Z")

</div>

Hey,

I have Ansible version 2.0.0.2 running in OS X.

I have noticed that when delegate\_to is used together with with\_items, only the first item in the list is executed and the rest are just ignored (although they show up in Ansible’s play output).

Here is an example:

I want to disable Apache httpd instance (hostname apachevm1) in a group of HAProxy load balancers (hostnames haproxyvm1 and haproxyvm2). The HAProxy hosts are in a group named lb.

---

<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 29, 2016, 8:27pm UTC](https://forum.ansible.com/t/delegate-to-and-with-items-together-only-the-first-item-is-executed-looped/20387/2 "2016-01-29T20:27:29Z")

</div>

check against current devel, this was a bug but should be fixed already.

---

<div class="post-metadata">

**Author:** ![Henri\_Volotinen](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@Henri\_Volotinen](https://forum.ansible.com/u/Henri_Volotinen)\
**Post date:** [January 30, 2016, 10:57am UTC](https://forum.ansible.com/t/delegate-to-and-with-items-together-only-the-first-item-is-executed-looped/20387/3 "2016-01-30T10:57:16Z")

</div>

I have now tried it with 2.0.1 RC1 and also with the latest devel (2.1.0) and seems to work the same way as it worked with 2.0.0.2 - keeps ignoring the rest of the items on the list. I also tried it with 1.9.4 and there it worked perfectly fine! So what gives. 🙂

///hege
