Sending the list of available updates via email

HI,

I would like to create a playbook that will send a list of available yum updates in the message body. How do I do that? my play book has two parts. first it collects a list of available packages and then 2nd it sends an email… I would like to include the results from first part in a readable format as message body in my email. Any help or guidance will be appreciated.

I tried stuff like that before using a block or multiline approach for the body attribute:

https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines

Maybe you can concatenate the lines of the command output in a previous step using ‘\n’ as EoL and save it into a variable. Then you can use that variable as part of the body.