how do I email results that are easy to read and confirm each member was added successfully?

This script is working but the results are difficult to read in the email that is sent.

Ideally I would like the email to say something like:

The following
Add: {{ member }} To: {{ group }} On: {{ ansible_hostname }} [has failed or was successful]

The following are the current members of the group Administrators on {{ ansible_hostname }}
DOM\First_Group
DOM\Second_Group

The data all seems to be in userData but I don’t know how to put some smarts to check it was successful and not sure how to list a clean list of the members of the group.

`

Create a template that formats it nicely and use:

body: '{{lookup("template", "pretty_email.j2")}}'

You could try to do the same inline, but it ends up making the task
hard to read and update.

Thanks Brian, I will look into this option :slight_smile: