W3cubDocs

/Ansible

community.grafana.grafana_notification_channel – Manage Grafana Notification Channels

Note

This plugin is part of the community.grafana collection (version 1.2.3).

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 version 1.1.0: of community.grafana

Synopsis

  • Create/Update/Delete Grafana Notification Channels via API.

Parameters

Parameter Choices/Defaults Comments
client_cert
path
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
client_key
path
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
list / elements=string
    Choices:
  • link
  • action_card
DingDing message type.
dingding_url
string
DingDing webhook URL.
disable_resolve_message
boolean
    Choices:
  • no
  • yes
Disable the resolve message.
discord_message_content
string
Overrides message content.
discord_url
string
Discord webhook URL.
email_addresses
list / elements=string
List of recipients.
email_single
boolean
    Choices:
  • no
  • yes
Send single email to all recipients.
googlechat_url
string
Google Hangouts webhook URL.
grafana_api_key
string
The Grafana API key.
If set, url_username and url_password will be ignored.
hipchat_api_key
string
HipChat API key.
hipchat_room_id
string
HipChat room ID.
hipchat_url
string
HipChat webhook URL.
include_image
boolean
    Choices:
  • no
  • yes
Capture a visualization image and attach it to notifications.
is_default
boolean
    Choices:
  • no
  • yes
Use this channel for all alerts.
kafka_topic
string
Kafka topic name.
kafka_url
string
Kafka REST proxy URL.
line_token
string
LINE token.
name
string
The name of the notification channel.
Required when state is present.
opsgenie_api_key
string
OpsGenie API key.
opsgenie_auto_close
boolean
    Choices:
  • no
  • yes
Automatically close alerts in OpsGenie once the alert goes back to ok.
opsgenie_override_priority
boolean
    Choices:
  • no
  • yes
Allow the alert priority to be set using the og_priority tag.
opsgenie_url
string
OpsGenie webhook URL.
org_id
integer
Default:
1
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..
pagerduty_auto_resolve
boolean
    Choices:
  • no
  • yes
Resolve incidents in PagerDuty once the alert goes back to ok.
pagerduty_integration_key
string
PagerDuty integration key.
pagerduty_message_in_details
boolean
    Choices:
  • no
  • yes
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.
pagerduty_severity
list / elements=string
    Choices:
  • critical
  • error
  • warning
  • info
Alert severity in PagerDuty.
prometheus_password
string
Prometheus password.
prometheus_url
string
Prometheus API URL.
prometheus_username
string
Prometheus username.
pushover_alert_sound
string
Alert sound in Pushover.
L(https://pushover.net/api#sounds)
pushover_api_token
string
Pushover API token.
pushover_devices
list / elements=string
Devices list in Pushover.
pushover_expire
integer
Expire alert in n minutes.
Only when priority is emergency.
pushover_ok_sound
string
OK sound in Pushover.
L(https://pushover.net/api#sounds)
pushover_priority
list / elements=string
    Choices:
  • emergency
  • high
  • normal
  • low
  • lowest
Alert priority in Pushover.
pushover_retry
integer
Retry in n minutes.
Only when priority is emergency.
pushover_user_key
string
Pushover user key.
reminder_frequency
string
Additional notifications interval for triggered alerts.
For example 15m.
sensu_handler
string
Sensu handler name.
sensu_password
string
Sensu password.
sensu_source
string
Source in Sensu.
sensu_url
string
Sensu webhook URL.
sensu_username
string
Sensu user.
slack_icon_emoji
string
An emoji to use for the bot's message.
slack_icon_url
string
URL to an image to use as the icon for the bot's message
slack_mention_channel
list / elements=string
    Choices:
  • here
  • channel
Mention whole channel or just active members.
slack_mention_groups
list / elements=string
Mention groups list.
slack_mention_users
list / elements=string
Mention users list.
slack_recipient
string
Override default Slack channel or user.
slack_token
string
Slack token.
slack_url
string
Slack webhook URL.
slack_username
string
Set the username for the bot's message.
state
string
    Choices:
  • present
  • absent
Status of the notification channel.
teams_url
string
Microsoft Teams webhook URL.
telegram_bot_token
string
Telegram bot token;
telegram_chat_id
string
Telegram chat id.
threema_api_secret
string
Threema Gateway API secret.
threema_gateway_id
string
8 character Threema Gateway ID (starting with a *).
threema_recepient_id
string
8 character Threema ID that should receive the alerts.
type
string
    Choices:
  • dingding
  • discord
  • email
  • googlechat
  • hipchat
  • kafka
  • line
  • teams
  • opsgenie
  • pagerduty
  • prometheus
  • pushover
  • sensu
  • slack
  • telegram
  • threema
  • victorops
  • webhook
The channel notification type.
Required when state is present.
uid
string
The channel unique identifier.
url
string / required
The Grafana URL.

aliases: grafana_url
url_password
string
Default:
"admin"
The Grafana password for API authentication.

aliases: grafana_password
url_username
string
Default:
"admin"
The Grafana user for API authentication.

aliases: grafana_user
use_proxy
boolean
    Choices:
  • no
  • yes
If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
validate_certs
boolean
    Choices:
  • no
  • yes
If no, SSL certificates will not be validated.
This should only set to no used on personally controlled sites using self-signed certificates.
victorops_auto_resolve
boolean
    Choices:
  • no
  • yes
Resolve incidents in VictorOps once the alert goes back to ok.
victorops_url
string
VictorOps webhook URL.
webhook_http_method
list / elements=string
    Choices:
  • POST
  • PUT
Webhook HTTP verb to use.
webhook_password
string
Webhook password.
webhook_url
string
Webhook URL
webhook_username
string
Webhook username.

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 Returned Description
notification_channel
dictionary
changed
Notification channel created or updated by the module.

Sample:
{ "created": "2020-11-10T21:10:19.675308051+03:00", "disableResolveMessage": false, "frequency": "", "id": 37, "isDefault": false, "name": "Oops", "secureFields": {}, "sendReminder": false, "settings": { "uploadImage": false, "url": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" }, "type": "slack", "uid": "slack-oops", "updated": "2020-11-10T21:10:19.675308112+03:00" }


Authors

  • Aliaksandr Mianzhynski (@amenzhinsky)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_notification_channel_module.html