Watching AWX: Status Views, Notifications, Logs, and Prometheus Metrics
Notifications: Templates, Custom Messages, and Inheritance Rules
AWX offers several ways to alert users about certain events occurring on the system. When you create a job template, you can specify a notification template to use when the job starts, succeeds, or fails (canceled jobs trigger the failure notification).
First, create a notification template. Go to Notifications > Add and fill in the details. Here are some types of notifications you can set up:
- Email: Sends an email to a user or group of users.
- Webhook: Sends a POST request to a URL.
- Slack: Sends a message to a Slack channel.
- Twilio: Sends an SMS message to a phone number.
- PagerDuty: Triggers an incident in PagerDuty.
- IRC: Sends a message to an IRC channel.
The number of built-in integrations is limited, but you can always use the Webhook integration to send notifications to any service that can receive a POST request.
Let's create two types of notifications: one for email and one for webhook. You can use the following free online services to test the email and webhook notifications:
- Email: WPOven
- Webhook: Webhook.site
When you create a notification, you can customize the message that will be sent. Here are some examples:
- Start message:
{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}: {{ url }}
- Success message:
{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}: {{ url }}
- Error message body:
{{ job_friendly_name }} #{{ job.id }} had status {{ job.status }}, view details at {{ url }}
{{ job_metadata }}
These are some default variables that you can use in the notification templates:
{{ job_friendly_name }}
AWX in Action
Ansible Orchestration at ScaleEnroll now to unlock all content and receive all future updates for free.
