Like cron, systemd services should be able to send a mail notification on failure.
Just add OnFailure=status-email-admin@%n.service
to your service file.
This role works only on systems running with systemd.
admin_mail
: Email address of the admin. This can be set e.g. as global variable ingroup_vars/all/main.yml
- hosts: servers
roles:
- role: systemd-statusmail
admin_mail: admin@example.com
MIT