# Acting on failure

**URL:** <https://forum.ansible.com/t/acting-on-failure/13467>\
**Category:** Ansible Project\
**Created:** [September 13, 2013, 11:45am UTC](https://forum.ansible.com/t/acting-on-failure/13467 "2013-09-13T11:45:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steen\_Larsen](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Steen\_Larsen](https://forum.ansible.com/u/Steen_Larsen)\
**Post date:** [September 13, 2013, 11:45am UTC](https://forum.ansible.com/t/acting-on-failure/13467/1 "2013-09-13T11:45:04Z")

</div>

Hi,

I’m pretty new to Ansible, but so far really like it. I am trying to write a continous deployment playbook, and so far it’s pretty need. One thing I haven’t been able to figure out is how to react to a task failure. I don’t wan’t to ignore the failure, and I’m fine with the play stopping, but I would like to be able to write a file upon failure, something a la

when: fail command echo “error1” \> /tmp/error

Is there a way to this. Catch the failure and react to it.

/Steen

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 13, 2013, 11:04pm UTC](https://forum.ansible.com/t/acting-on-failure/13467/2 "2013-09-13T23:04:03Z")

</div>

You can use “register” along with “ignore\_errors” right now.

You would ignore the error and still be able to use the “when” statement in a later task to react to it.

Hope this helps!
