# Task prerequisites

**URL:** <https://forum.ansible.com/t/task-prerequisites/11776>\
**Category:** Ansible Project\
**Created:** [August 9, 2012, 6:38am UTC](https://forum.ansible.com/t/task-prerequisites/11776 "2012-08-09T06:38:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Thames](https://avatars.discourse-cdn.com/v4/letter/w/dc4da7/32.png) [@Will\_Thames](https://forum.ansible.com/u/Will_Thames)\
**Post date:** [August 9, 2012, 6:38am UTC](https://forum.ansible.com/t/task-prerequisites/11776/1 "2012-08-09T06:38:25Z")

</div>

Is there a way to fail nicely (rather than do nothing, which only\_if would probably provide) when certain requirements aren’t satisfied?

For example, let’s say I want to install some software, but there’s no point doing it unless a data mountpoint exists. Or I haven’t linked two playbooks together but it only makes sense to run the second after the first.

This would probably have to be based on file existence or the results of a command.

name: check for /data mountpoint  
action: assert exists /data

name: user oracle exists  
action: assert command getent passwd oracle

The playbook continues if the assertion is true, and stops if the assertion is false.

Anyway, I’m sure there are plenty of ways to achieve this kind of thing, some of which may already exist. And if it doesn’t yet exist, let me know what a good syntax would look like and I’lll see what I can come up with…

Will

---

<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:** [August 9, 2012, 12:17pm UTC](https://forum.ansible.com/t/task-prerequisites/11776/2 "2012-08-09T12:17:03Z")

</div>

(A) it will be true at some point in 0.7 that we can reference the  
return value of the last result as a variable like $last\_result, which  
would be usable in only\_if. Until now, and even later, you can still  
write  
a custom fact to return the presense/absense of a path.

(B) if you haven't linked it, I don't understand how it could  
possibly know that, so that doesn't make sense to me.
