# Ansible error code for a role, not each ansible task

**URL:** <https://forum.ansible.com/t/ansible-error-code-for-a-role-not-each-ansible-task/21196>\
**Category:** Ansible Project\
**Created:** [April 18, 2016, 3:58pm UTC](https://forum.ansible.com/t/ansible-error-code-for-a-role-not-each-ansible-task/21196 "2016-04-18T15:58:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_M](https://avatars.discourse-cdn.com/v4/letter/r/9fc348/32.png) [@Richard\_M](https://forum.ansible.com/u/Richard_M)\
**Post date:** [April 18, 2016, 3:58pm UTC](https://forum.ansible.com/t/ansible-error-code-for-a-role-not-each-ansible-task/21196/1 "2016-04-18T15:58:32Z")

</div>

Is it possible to capture an error code (success/failure) at the level of an ansible **role** and not each individual task?

We have a rather complex ansible playbook with multiple roles and would like to be able to log ( **on the remote** ) the success/failure of each role.

For example, the playbook has five roles. Each playbook role can be individually called using command line options (-e). If two roles are called in the playbook and the second role fails, can the error codes be captured for each of the two roles and written to a file on the remote server (not just in the ansible log file). eg. Role 1 shows success, role two shows failure.

Thanks
