Capturing STDOUT & STDERR for Customised Notification

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

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.

Ok - but will returned_vars be available for embedding in a notification template like {{ job.summary_fields.inventory.name}} for instance?