# How to execute pre tasks on all hosts before running tasks serial:1

**URL:** <https://forum.ansible.com/t/how-to-execute-pre-tasks-on-all-hosts-before-running-tasks-serial-1/18548>\
**Category:** Ansible Project\
**Created:** [June 19, 2015, 8:55am UTC](https://forum.ansible.com/t/how-to-execute-pre-tasks-on-all-hosts-before-running-tasks-serial-1/18548 "2015-06-19T08:55:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_van\_der\_Hout](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Mark\_van\_der\_Hout](https://forum.ansible.com/u/Mark_van_der_Hout)\
**Post date:** [June 19, 2015, 8:55am UTC](https://forum.ansible.com/t/how-to-execute-pre-tasks-on-all-hosts-before-running-tasks-serial-1/18548/1 "2015-06-19T08:55:45Z")

</div>

Hi,

I have a playbook which deploys a new .war file for a tomcat instance. Since there are 6 hosts in a loadbalanced setup I have configured to run the playbook on 1 host at a time.  
However, I want to do a ‘pre flight check’ on all hosts if the directory where the .war file is placed even exists, to make sure the playbook won’t break in the middle of a deployment.

Is there a way to execute tasks on all hosts before running serial=1 and thus doing the actual deployment?

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [June 19, 2015, 9:09am UTC](https://forum.ansible.com/t/how-to-execute-pre-tasks-on-all-hosts-before-running-tasks-serial-1/18548/2 "2015-06-19T09:09:54Z")

</div>

Just create two plays in the same playbook file. The first can run in parallel and the second in serial.

---

<div class="post-metadata">

**Author:** ![Mark\_van\_der\_Hout](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Mark\_van\_der\_Hout](https://forum.ansible.com/u/Mark_van_der_Hout)\
**Post date:** [June 19, 2015, 9:20am UTC](https://forum.ansible.com/t/how-to-execute-pre-tasks-on-all-hosts-before-running-tasks-serial-1/18548/3 "2015-06-19T09:20:50Z")

</div>

I feel kinda stupid now. Thanks for pointing out the obvious!
