Sending email notifications to group once playbook is executed

Hello Everyone…!

I have a scenario where I have to send an email to a group of people based on playbook completion.

Site.yml - > master playbook consists of all individual playbook.

app1.yml
app2.yml
app3.yml

host file -
app1_host
SERVER1

app2_host
SERVER2

app3_host
SERVER3

  1. I have app1.yml which calls roles to perform series of task on SERVER1. app2.yml to call same roles to perform same set of tasks on SERVER2
    I can include email module in roles at the end to send an email once all the tasks are completed.

But

  1. I have site.yml ( master playbook) which calls multiple playbooks like

app1.yml
app2.yml
app3.yml

Now, when site.yml calls app1.yml => tasks are execute => email sent.
site.yml calls app2.yml => tasks are execute => email sent.
site.yml calls app3.yml => tasks are execute => email sent.

How can I achieve to make ansible to send email only once if site.yml is called OR at end site.yml tasks are completed?

Any suggestion…!

Thanks,
Balaji Chavdi

Add a play in bottom of site.yml that sends the mail.

there is also the mail callback plugin