Email Notifications
Send an email when a job finishes
When you want to send an email on job-event
Email Templates
Notification emails use HTML templates located in server/src/templates/:
approval.html- Approval request notificationsjobstatus.html- Job outcome notifications (success, failed, aborted, warning)jobevent.html- Job lifecycle event notifications (launch, relaunch, delete, approve, reject)
These templates can be customized by replacing them with your own versions.
In Docker or Kubernetes deployments, mount your custom templates to/app/dist/src/templates/to override the defaults.
Example Docker mount:-v /path/to/custom/templates:/app/dist/src/templates/
Attributes
The attributes of the notifications object:
| Attribute | Comments |
|---|---|
| recipients array / required | Recipients
A list of email addresses who need to receive a notification |
| onStatus array | Jobstatus event
A list of jobstatus events you want to send a notification on. Use Choices:
|
| onEvent array | Job trigger events
A list of job lifecycle events (triggers) you want to send a notification on. Choices:
|
Examples
Example notifications, in YAML:
1) Send a notification on failed
The definition, in YAML:
notifications:
recipients:
- info@ansibleguy.com
onStatus:
- failed
2) Send notifications on job events (launch, relaunch, approve, reject)
The definition, in YAML:
notifications:
recipients:
- admin@ansibleguy.com
- auditor@ansibleguy.com
onEvent:
- launch
- relaunch
- approve
- reject
3) Send notifications on all events
The definition, in YAML:
notifications:
recipients:
- admin@ansibleguy.com
onStatus:
- any
onEvent:
- launch
- relaunch
- delete
- approve
- reject