# Using existing modules to determine whether to run a script?

**URL:** <https://forum.ansible.com/t/using-existing-modules-to-determine-whether-to-run-a-script/14626>\
**Category:** Ansible Project\
**Created:** [February 21, 2014, 8:02pm UTC](https://forum.ansible.com/t/using-existing-modules-to-determine-whether-to-run-a-script/14626 "2014-02-21T20:02:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kim\_Betti](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kim\_Betti](https://forum.ansible.com/u/Kim_Betti)\
**Post date:** [February 21, 2014, 8:02pm UTC](https://forum.ansible.com/t/using-existing-modules-to-determine-whether-to-run-a-script/14626/1 "2014-02-21T20:02:31Z")

</div>

I’ve started looking into Ansible and I quite like it.

Is it possible to run a shell script only if the yum module determines that a given package is -not- installed?

Or in more general terms, is there a convenient way to leverage existing modules to decide whether or not to run a task?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [February 21, 2014, 8:51pm UTC](https://forum.ansible.com/t/using-existing-modules-to-determine-whether-to-run-a-script/14626/2 "2014-02-21T20:51:45Z")

</div>

tasks/modules can register output register: var, you can use that in when: clause in all/any subsequent tasks.
