# Keep running playbook only if package is installed

**URL:** <https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911>\
**Category:** Ansible Project\
**Created:** [September 19, 2012, 7:05pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911 "2012-09-19T19:05:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PePe\_Amengual](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@PePe\_Amengual](https://forum.ansible.com/u/PePe_Amengual)\
**Post date:** [September 19, 2012, 7:05pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/1 "2012-09-19T19:05:49Z")

</div>

Hi…yes it is me again…

So I was trying to stop a playbook or skip part of it if a package was not installed, in this is case is a playbook for mac.

this is my playbook base on the conditional task execution :

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 19, 2012, 7:15pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/2 "2012-09-19T19:15:07Z")

</div>

Only if will print "skipped" already when skipping tasks, might this be sufficient?

-- Michael

---

<div class="post-metadata">

**Author:** ![PePe\_Amengual](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@PePe\_Amengual](https://forum.ansible.com/u/PePe_Amengual)\
**Post date:** [September 19, 2012, 7:52pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/3 "2012-09-19T19:52:08Z")

</div>

Mmm I guess.

I just wanted to be more specific for the user that is not familiar to ansible.

Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 19, 2012, 8:01pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/4 "2012-09-19T20:01:28Z")

</div>

You could write a callback, there is an on\_skipped function available.

-- Michael

---

<div class="post-metadata">

**Author:** ![PePe\_Amengual](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@PePe\_Amengual](https://forum.ansible.com/u/PePe_Amengual)\
**Post date:** [September 19, 2012, 8:27pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/5 "2012-09-19T20:27:03Z")

</div>

There is any doc where you can point me at so I can see some example of it ?

Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 19, 2012, 8:44pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/6 "2012-09-19T20:44:35Z")

</div>

See the ansible-plugins repo for a couple of working examples.

– Michael

---

<div class="post-metadata">

**Author:** ![PePe\_Amengual](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@PePe\_Amengual](https://forum.ansible.com/u/PePe_Amengual)\
**Post date:** [September 19, 2012, 10:03pm UTC](https://forum.ansible.com/t/keep-running-playbook-only-if-package-is-installed/11911/7 "2012-09-19T22:03:47Z")

</div>

Thanks again
