Notificacions
Envia un correu o un missatge a un canal quan una tasca acaba o li passa alguna cosa
Les notifications d’un formulari indiquen qui s’assabenta de les seves tasques, i quan:
- Qui:
recipients, adreces de correu electrònic, ichannels, els noms dels canals de notificació (correu, Slack, Microsoft Teams, Telegram, un webhook). Cal com a mínim un dels dos. - Quan:
onStatus, quan una tasca acaba (success,failed,aborted,warningoany), ionEvent, quan li passa alguna cosa a una tasca (launch,relaunch,delete,approve,rejectoany).
notifications:
recipients:
- ops@example.com
channels:
- ops-teams
onStatus:
- failed
onEvent:
- approve
- reject
When you want to send a notification on job-event: an email, and a message to notification channels (Connections > Notifications: Slack, Microsoft Teams, Telegram, a webhook)
Email Templates
Notification emails use HTML templates located in server/templates/email/:
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/templates/email/to override the defaults.
Example Docker mount:-v /path/to/custom/templates:/app/dist/templates/email/
A mount at the former location,/app/dist/src/templates/, keeps working and takes precedence.
Atributs
Els atributs de l’objecte notifications:
| Atribut | Comentaris |
|---|---|
| recipients array | Recipients
A list of email addresses who need to receive a notification. |
| channels array | Channels
The notification channels of Connections > Notifications the notification goes to: Slack, Microsoft Teams, Telegram, a webhook. They get a short message (the form, the job, what happened) with a link to the job. |
| onStatus array | Jobstatus event
A list of jobstatus events you want to send a notification on. Use Opcions:
|
| onEvent array | Job trigger events
A list of job lifecycle events (triggers) you want to send a notification on. Opcions:
|
Exemples
Exemples de notificacions, en YAML:
1) Send a notification on failed
La definició, en YAML:
notifications:
recipients:
- info@ansibleguy.com
onStatus:
- failed
2) Send notifications on job events (launch, relaunch, approve, reject)
La definició, en YAML:
notifications:
recipients:
- admin@ansibleguy.com
- auditor@ansibleguy.com
onEvent:
- launch
- relaunch
- approve
- reject
3) Send notifications on all events
La definició, en YAML:
notifications:
recipients:
- admin@ansibleguy.com
onStatus:
- any
onEvent:
- launch
- relaunch
- delete
- approve
- reject