# cross-playbook serial?

**URL:** <https://forum.ansible.com/t/cross-playbook-serial/17077>\
**Category:** Ansible Project\
**Created:** [December 16, 2014, 3:41pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077 "2014-12-16T15:41:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [December 16, 2014, 3:41pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/1 "2014-12-16T15:41:04Z")

</div>

Hi  
I’m running a deployment that consists of different plays, some of which are already written that I would like to reuse. There’s about one one play for each stage:

1. Remove server from cluster
2. Shut down the server
3. Provision a new server to replace it

When running, I need each set of plays to run on one server at a time, so setting ‘serial’ on the play level isn’t enough. I know I can run another ansible-playbook instance with the command module, but then I wouldn’t see the progress for each play. I guess I can copy-paste my existing playbooks and play with delegate\_to to achieve what I want, but that feels wrong. What I’m doing currently is splitting my playbook run to several pieces and gluing them with bash, looping when necessary on a single playbook.

It feels like Ansible doesn’t support this use case well currently. Is there a better way to solve that than using bash? Are there features in the pipeline to help with this case?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![kesten\_broughton1](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kesten\_broughton1](https://forum.ansible.com/u/kesten_broughton1)\
**Post date:** [December 16, 2014, 5:57pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/2 "2014-12-16T17:57:18Z")

</div>

+1  
I have this problem a lot when I use delegate\_to with multiple targets making a request of a single delegate. Lock conflicts cause intermittent failure.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 16, 2014, 6:36pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/3 "2014-12-16T18:36:33Z")

</div>

Sounds like you are looking for a flag to override --serial to me, which may be reasonable.

In the meantime, can you just set serial: 1 on each play?

---

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [December 16, 2014, 6:48pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/4 "2014-12-16T18:48:04Z")

</div>

That won’t help me. If i have one play to remove a node from a cluster, one to shut it down and one to provision a new one, i need the tasks in all of them to run for each host. Removing all nodes, then shutting them all down, etc isn’t good.

Ideally I’d have one task for each. But when that task is a play by itself, that’s where my problem is.

---

<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:** [December 16, 2014, 7:33pm UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/5 "2014-12-16T19:33:50Z")

</div>

so I think you need 4 plays, make the tasks into their own files, use  
- include in all plays, you have the same tasks but use the different  
plays for each of the different needs.

plays 1,2,3 as you have now, play 4, with serial: 1, uses tasks from  
play 1, 2 and 3 in order.

---

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [December 17, 2014, 8:32am UTC](https://forum.ansible.com/t/cross-playbook-serial/17077/6 "2014-12-17T08:32:20Z")

</div>

Thanks Brian, that looks like it could work. I’m not sure I like doing a small refactor for this though. Plus I still have to copy the ‘role:’ sections. Eh… I’ll think of something. Thanks!
