community.grafana.grafana_notification_channel module – Manage Grafana Notification Channels
Note
This module is part of the community.grafana collection (version 1.5.4).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.grafana
.
To use it in a playbook, specify: community.grafana.grafana_notification_channel
.
New in community.grafana 1.1.0
Synopsis
Create/Update/Delete Grafana Notification Channels via API.
Parameters
Parameter |
Comments |
---|---|
PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, client_key is not required |
|
PEM formatted file that contains your private key to be used for SSL client authentication. If client_cert contains both the certificate and key, this option is not required. |
|
DingDing message type. Choices:
|
|
DingDing webhook URL. |
|
Disable the resolve message. Choices:
|
|
Overrides message content. |
|
Discord webhook URL. |
|
List of recipients. |
|
Send single email to all recipients. Choices:
|
|
Google Hangouts webhook URL. |
|
The Grafana API key. If set, |
|
HipChat API key. |
|
HipChat room ID. |
|
HipChat webhook URL. |
|
Capture a visualization image and attach it to notifications. Choices:
|
|
Use this channel for all alerts. Choices:
|
|
Kafka topic name. |
|
Kafka REST proxy URL. |
|
LINE token. |
|
The name of the notification channel. Required when state is |
|
OpsGenie API key. |
|
Automatically close alerts in OpsGenie once the alert goes back to ok. Choices:
|
|
Allow the alert priority to be set using the og_priority tag. Choices:
|
|
OpsGenie webhook URL. |
|
The Grafana Organisation ID where the dashboard will be imported / exported. Not used when grafana_api_key is set, because the grafana_api_key only belongs to one organisation.. Default: |
|
Resolve incidents in PagerDuty once the alert goes back to ok. Choices:
|
|
PagerDuty integration key. |
|
Move the alert message from the PD summary into the custom details. This changes the custom details object and may break event rules you have configured. Choices:
|
|
Alert severity in PagerDuty. Choices:
|
|
Prometheus password. |
|
Prometheus API URL. |
|
Prometheus username. |
|
Pushover API token. |
|
Devices list in Pushover. |
|
Expire alert in Only when priority is |
|
Alert priority in Pushover. Choices:
|
|
Retry in Only when priority is |
|
Pushover user key. |
|
Additional notifications interval for triggered alerts. For example |
|
Sensu handler name. |
|
Sensu password. |
|
Source in Sensu. |
|
Sensu webhook URL. |
|
Sensu user. |
|
An emoji to use for the bot’s message. |
|
URL to an image to use as the icon for the bot’s message |
|
Mention whole channel or just active members. Choices:
|
|
Mention groups list. |
|
Mention users list. |
|
Override default Slack channel or user. |
|
Slack token. |
|
Slack webhook URL. |
|
Set the username for the bot’s message. |
|
Status of the notification channel. Choices:
|
|
Microsoft Teams webhook URL. |
|
Telegram bot token; |
|
Telegram chat id. |
|
Threema Gateway API secret. |
|
8 character Threema Gateway ID (starting with a *). |
|
8 character Threema ID that should receive the alerts. |
|
The channel notification type. Required when state is Choices:
|
|
The channel unique identifier. |
|
The Grafana URL. |
|
The Grafana password for API authentication. Default: |
|
The Grafana user for API authentication. Default: |
|
If Choices:
|
|
If This should only set to Choices:
|
|
Resolve incidents in VictorOps once the alert goes back to ok. Choices:
|
|
VictorOps webhook URL. |
|
Webhook HTTP verb to use. Choices:
|
|
Webhook password. |
|
Webhook URL |
|
Webhook username. |
Notes
Note
Notification channels are replaced by contact points starting Grafana 8.3 and this module is currently not able to manage contact points.
The module will report execution as successful since Grafana maintains backward compatibility with previous alert management, but
nothing will be visible in the contact points if new alerting mechanism is enabled.
Examples
- name: Create slack notification channel
register: result
grafana_notification_channel:
uid: slack
name: slack
type: slack
slack_url: https://hooks.slack.com/services/xxx/yyy/zzz
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"
- name: Delete slack notification channel
register: result
grafana_notification_channel:
state: absent
uid: slack
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Notification channel created or updated by the module. Returned: changed Sample: |