# delegate\_to a whole group: is it sequential or parallel?

**URL:** <https://forum.ansible.com/t/delegate-to-a-whole-group-is-it-sequential-or-parallel/20741>\
**Category:** Ansible Project\
**Created:** [March 2, 2016, 2:13am UTC](https://forum.ansible.com/t/delegate-to-a-whole-group-is-it-sequential-or-parallel/20741 "2016-03-02T02:13:12Z")\
**Posts on this page:** 3\
**Page:** 1

<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 2, 2016, 2:13am UTC](https://forum.ansible.com/t/delegate-to-a-whole-group-is-it-sequential-or-parallel/20741/1 "2016-03-02T02:13:12Z")

</div>

- name: disable instance on HAproxy and wait for it to go offline  
haproxy: state=disabled backend=app\_back host={{ inventory\_hostname\_short }} socket=/run/haproxy/admin.sock shutdown\_sessions=no wait=yes  
delegate\_to: “{{ item }}”  
with\_items: groups.haproxy\_app

The haproxy\_app group has 3 instances (hap01 … hap03), and the main playbook is executed on 10 instances, and it’s sequential, app01 to app10.

Let’s say the main playbook is now executed on app01, and it hits the haproxy task. Is the haproxy task going to be delegated to all haproxy instances at once, in parallel (from the p.o.v. of app01), or is it going to be executed sequentially, hap01, then hap02, then hap03?

Again, I am talking from the p.o.v. of each app instance where the main playbook is being executed.

The reason why I’m asking: This is the task which disables an app instance in HAproxy, and I would like each app to be disabled more or less at once on all proxies (in parallel). I want to avoid, as much as possible, the slower sequential process where an app instance is disabled on each proxy sequentially, one by one.

---

<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:** [March 2, 2016, 11:50pm UTC](https://forum.ansible.com/t/delegate-to-a-whole-group-is-it-sequential-or-parallel/20741/2 "2016-03-02T23:50:15Z")

</div>

delegate\_to is not inherently parallel or serial, there is no relationships with it and forks. Parallelism depends on the play and task, with\_ loops are currently ONLY serial, so if you delegate\_to: “{{item}}” it is serial in the loop, but it is parallel across the play hosts.

---

<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 3, 2016, 12:04am UTC](https://forum.ansible.com/t/delegate-to-a-whole-group-is-it-sequential-or-parallel/20741/3 "2016-03-03T00:04:21Z")

</div>

Makes sense, thanks. But is there a way to parallelize delegate\_to somehow? All looping methods I’m aware of are based on with\_ and that’s, as you said, serial.
