# Capturing STDOUT & STDERR for Customised Notification

**URL:** <https://forum.ansible.com/t/capturing-stdout-stderr-for-customised-notification/33496>\
**Category:** AWX Project\
**Created:** [July 26, 2020, 1:23pm UTC](https://forum.ansible.com/t/capturing-stdout-stderr-for-customised-notification/33496 "2020-07-26T13:23:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Cal](https://avatars.discourse-cdn.com/v4/letter/r/eb9ed0/32.png) [@Rob\_Cal](https://forum.ansible.com/u/Rob_Cal)\
**Post date:** [July 26, 2020, 1:23pm UTC](https://forum.ansible.com/t/capturing-stdout-stderr-for-customised-notification/33496/1 "2020-07-26T13:23:51Z")

</div>

Hi - so I know we can access {{ job\_friendly\_name }}, {{ job.summary\_fields.inventory.name }} and the like for customised notification content.

However, it would be useful for me to capture also the STDOUT & STDERR contents as well - if possible, by using attributes.

Is that possible?

Regards,

Roberto

---

<div class="post-metadata">

**Author:** ![Mike\_Charchuk](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Charchuk](https://forum.ansible.com/u/Mike_Charchuk)\
**Post date:** [July 26, 2020, 3:49pm UTC](https://forum.ansible.com/t/capturing-stdout-stderr-for-customised-notification/33496/2 "2020-07-26T15:49:43Z")

</div>

Most command modules return stdout and stderr so that you can reference them with a register variable.

command: whoami  
register: returned\_vars

Then you can use returned\_vars.stdout or returned\_vars.stderr in subsequent tasks such as one using set\_stats to assign to another variable for use in later jobs if using a workflow or set\_fact for use in the current playbook.

---

<div class="post-metadata">

**Author:** ![Rob\_Cal](https://avatars.discourse-cdn.com/v4/letter/r/eb9ed0/32.png) [@Rob\_Cal](https://forum.ansible.com/u/Rob_Cal)\
**Post date:** [July 27, 2020, 12:57am UTC](https://forum.ansible.com/t/capturing-stdout-stderr-for-customised-notification/33496/3 "2020-07-27T00:57:10Z")

</div>

Ok - but will returned\_vars be available for embedding in a notification template like {{ job.summary\_fields.inventory.name}} for instance?
