# global role hooks

**URL:** <https://forum.ansible.com/t/global-role-hooks/14955>\
**Category:** Ansible Developer\
**Created:** [April 7, 2014, 12:45pm UTC](https://forum.ansible.com/t/global-role-hooks/14955 "2014-04-07T12:45:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitry.a.burmistrov](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dmitry.a.burmistrov](https://forum.ansible.com/u/dmitry.a.burmistrov)\
**Post date:** [April 7, 2014, 12:45pm UTC](https://forum.ansible.com/t/global-role-hooks/14955/1 "2014-04-07T12:45:49Z")

</div>

I have role, I run playbook. It finished successfully, and I want to make some post-role action (like set some flags in other system, put file or etc). In this case the behavior is predictable (I have task in playbook).  
But when play failed, it is harder. I want to do some actions in that case and notify people.

What about adding directory in role tree structure for “success”-hook and “failure”-hook? And some forward thought: failure-hook with access to failed task information would be super cool.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 7, 2014, 4:18pm UTC](https://forum.ansible.com/t/global-role-hooks/14955/2 "2014-04-07T16:18:12Z")

</div>

Right now the best you have is to key off the /usr/bin/ansible-playbook return code like so:

/usr/bin/ansible-playbook foo.yml || something\_else.sh
