# How to execute Play 2 only if Play 1 succeeds

**URL:** <https://forum.ansible.com/t/how-to-execute-play-2-only-if-play-1-succeeds/32555>\
**Category:** Ansible Project\
**Created:** [March 29, 2020, 10:59am UTC](https://forum.ansible.com/t/how-to-execute-play-2-only-if-play-1-succeeds/32555 "2020-03-29T10:59:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shifa\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Shifa\_Shaikh](https://forum.ansible.com/u/Shifa_Shaikh)\
**Post date:** [March 29, 2020, 10:59am UTC](https://forum.ansible.com/t/how-to-execute-play-2-only-if-play-1-succeeds/32555/1 "2020-03-29T10:59:59Z")

</div>

I have two Plays having one task each.

The first Play 1 checks if the`/var/test.dat`exists on each target host.

Only if the Play 1 is successful do I want the second play Play 2 to run which executes scripts in parallel.

If Play 1 fails i.e if the test.dat does not exist I wish to terminate the entire playbook without the Play 2 getting executed.

For this purpose, I have set `any_errors_fatal` set to true

I need to have an ansible Play `strategy` set to free as each of the scripts takes 30 minutes to complete hence running them in parallel is the requirement.

My understanding of ansible is limited.

I understand that if I have both the tasks under a single Play and set the strategy to free both the tasks will run in parallel which is something I do not want.

`

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 29, 2020, 2:38pm UTC](https://forum.ansible.com/t/how-to-execute-play-2-only-if-play-1-succeeds/32555/2 "2020-03-29T14:38:24Z")

</div>

It works if you do it in a single play.

Why are you using two different plays anyway?
