community.grafana.grafana_contact_point module – Manage Grafana Contact Points

Note

This module is part of the community.grafana collection (version 2.1.0).

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_contact_point.

New in community.grafana 2.0.0

Synopsis

  • Create/Update/Delete Grafana Contact Points via API.

Parameters

Parameter

Comments

alertmanager_password

string

Password for accessing Alertmanager.

alertmanager_url

string

URL for accessing Alertmanager.

Required when type is alertmanager.

alertmanager_username

string

Username for accessing Alertmanager.

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

string

The message to send via DingDing.

dingding_message_type

string

The type of message to send via DingDing.

dingding_title

string

The title of the DingDing message.

dingding_url

string

The URL for DingDing webhook.

Required when type is dingding.

disable_resolve_message

boolean

Disables the resolve message.

Choices:

  • false ← (default)

  • true

discord_avatar_url

string

The avatar URL for Discord messages.

discord_message

string

The message to send via Discord.

discord_title

string

The title of the Discord message.

discord_url

string

The URL for Discord webhook.

Required when type is discord.

discord_use_username

boolean

Whether to use a custom username in Discord.

Choices:

  • false ← (default)

  • true

email_addresses

list / elements=string

List of email addresses to send the message to.

Required when type is email.

email_message

string

The content of the email message.

email_single

boolean

Whether to send a single email or individual emails.

Choices:

  • false ← (default)

  • true

email_subject

string

The subject of the email.

googlechat_message

string

The message to send via Google Chat.

googlechat_title

string

The title of the Google Chat message.

googlechat_url

string

The URL for Google Chat webhook.

Required when type is webhook.

grafana_api_key

string

The Grafana API key.

If set, url_username and url_password will be ignored.

include_image

boolean

Whether to include an image in the notification.

Choices:

  • false ← (default)

  • true

kafka_api_version

string

The API version for Kafka.

Default: "v2"

kafka_cluster_id

string

The cluster ID for Kafka.

kafka_description

string

The description for the Kafka configuration.

kafka_details

string

Additional details for Kafka.

kafka_password

string

Password for accessing Kafka.

kafka_rest_proxy_url

string

URL for Kafka REST Proxy.

Required when type is kafka.

kafka_topic

string

Kafka topic to publish to.

Required when type is kafka.

kafka_username

string

Username for accessing Kafka.

line_description

string

Description for the Line message.

line_title

string

Title of the Line message.

line_token

string

Access token for Line.

Required when type is line.

name

string

The name of the contact point.

Required when state is present.

opsgenie_api_key

string

API key for OpsGenie.

Required when type is opsgenie.

opsgenie_auto_close

boolean

Whether to enable auto-closing of alerts in OpsGenie.

Choices:

  • false

  • true

opsgenie_description

string

Description of the OpsGenie alert.

opsgenie_message

string

Message to send via OpsGenie.

opsgenie_override_priority

boolean

Whether to override the priority in OpsGenie.

Choices:

  • false

  • true

opsgenie_responders

list / elements=dictionary

List of responders for OpsGenie alerts.

opsgenie_send_tags_as

string

Format for sending tags in OpsGenie.

opsgenie_url

string

URL for OpsGenie webhook.

Required when type is pagerduty.

org_id

integer

The organization ID.

Default: 1

org_name

string

The name of the organization.

pagerduty_class

string

Class of the PagerDuty alert.

pagerduty_client

string

Client identifier for PagerDuty.

pagerduty_client_url

string

Client URL for PagerDuty.

pagerduty_component

string

Component involved in the PagerDuty alert.

pagerduty_details

list / elements=dictionary

List of additional details for PagerDuty.

pagerduty_group

string

Group associated with the PagerDuty alert.

pagerduty_integration_key

string

Integration key for PagerDuty.

Required when type is pagerduty.

pagerduty_severity

string

Severity level of the PagerDuty alert.

Choices:

  • "critical"

  • "error"

  • "warning"

  • "info"

pagerduty_source

string

Source of the PagerDuty alert.

pagerduty_summary

string

Summary of the PagerDuty alert.

provisioning

boolean

Indicates if provisioning is enabled.

Choices:

  • false

  • true ← (default)

pushover_api_token

string

API token for Pushover.

Required when type is pushover.

pushover_devices

list / elements=string

List of devices for Pushover notifications.

pushover_expire

integer

Expiration time for Pushover notifications.

pushover_message

string

Message to send via Pushover.

pushover_ok_priority

integer

Priority for OK messages in Pushover.

pushover_ok_sound

string

Sound for OK messages in Pushover.

pushover_priority

integer

Priority for Pushover messages.

pushover_retry

integer

Retry interval for Pushover messages.

pushover_sound

string

Sound for Pushover notifications.

pushover_title

string

Title of the Pushover message.

pushover_upload_image

boolean

Whether to upload an image with Pushover notification.

Choices:

  • false

  • true ← (default)

pushover_user_key

string

User key for Pushover.

Required when type is pushover.

sensugo_api_key

string

API key for Sensu Go.

Required when type is pushover.

sensugo_check

string

Check name for Sensu Go.

sensugo_entity

string

Entity name for Sensu Go.

sensugo_handler

string

Handler for Sensu Go.

sensugo_message

string

Message to send via Sensu Go.

sensugo_namespace

string

Namespace for Sensu Go.

sensugo_url

string

URL for Sensu Go.

Required when type is sensugo.

slack_endpoint_url

string

Endpoint URL for Slack webhook.

slack_icon_emoji

string

Icon emoji for Slack messages.

slack_icon_url

string

Icon URL for Slack messages.

slack_mention_channel

string

Channel mention for Slack messages.

Choices:

  • "here"

  • "channel"

slack_mention_groups

list / elements=string

List of groups to mention in Slack messages.

slack_mention_users

list / elements=string

List of users to mention in Slack messages.

slack_recipient

string

Recipient for Slack messages.

Required when type is slack.

slack_text

string

Text content for Slack messages.

slack_title

string

Title of the Slack message.

slack_token

string

Token for Slack authentication.

Required when type is slack.

slack_url

string

URL for Slack webhook.

Required when type is slack.

slack_username

string

Username to use in Slack messages.

state

string

Status of the contact point.

Choices:

  • "present" ← (default)

  • "absent"

teams_message

string

Message to send via Microsoft Teams.

teams_section_title

string

Section title for Microsoft Teams messages.

teams_title

string

Title of the Microsoft Teams message.

teams_url

string

URL for Microsoft Teams webhook.

Required when type is teams.

telegram_chat_id

string

Chat ID for Telegram.

Required when type is telegram.

telegram_disable_notifications

boolean

Whether to disable notifications for Telegram messages.

Choices:

  • false

  • true

telegram_message

string

Message to send via Telegram.

telegram_parse_mode

string

Parse mode for Telegram messages.

telegram_protect_content

boolean

Whether to protect content in Telegram messages.

Choices:

  • false

  • true

telegram_token

string

Token for Telegram authentication.

Required when type is telegram.

telegram_web_page_view

boolean

Whether to enable web page preview in Telegram messages.

Choices:

  • false

  • true

threema_api_secret

string

API secret for Threema.

Required when type is threema.

threema_description

string

Description for Threema messages.

threema_gateway_id

string

Gateway ID for Threema.

Required when type is threema.

threema_recipient_id

string

Recipient ID for Threema messages.

Required when type is threema.

threema_title

string

Title of the Threema message.

type

string

The type of the contact point.

Required when state is present.

Choices:

  • "alertmanager"

  • "dingding"

  • "discord"

  • "email"

  • "googlechat"

  • "kafka"

  • "line"

  • "opsgenie"

  • "pagerduty"

  • "pushover"

  • "sensugo"

  • "slack"

  • "teams"

  • "telegram"

  • "threema"

  • "victorops"

  • "webex"

  • "webhook"

  • "wecom"

uid

string / required

The unique ID of the contact point.

Normally the uid is generated randomly, but it is required for handling the contact point via API.

url

aliases: grafana_url

string / required

The Grafana URL.

url_password

aliases: grafana_password

string

The Grafana password for API authentication.

Default: "admin"

url_username

aliases: grafana_user

string

The Grafana user for API authentication.

Default: "admin"

use_proxy

boolean

If false, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • false

  • true ← (default)

validate_certs

boolean

If false, SSL certificates will not be validated.

This should only set to false used on personally controlled sites using self-signed certificates.

Choices:

  • false

  • true ← (default)

victorops_description

string

Description for VictorOps messages.

victorops_message_type

string

Message type for VictorOps.

Choices:

  • "CRITICAL"

  • "RECOVERY"

victorops_title

string

Title of the VictorOps message.

victorops_url

string

URL for VictorOps webhook.

Required when type is victorops.

webex_api_url

string

API URL for Webex.

webex_message

string

Message to send via Webex.

webex_room_id

string

Room ID for Webex messages.

Required when type is webex.

webex_token

string

Token for Webex authentication.

Required when type is webex.

webhook_authorization_credentials

string

Authorization credentials for webhook.

webhook_authorization_scheme

string

Authorization scheme for webhook.

webhook_http_method

string

HTTP method for webhook.

Choices:

  • "POST"

  • "PUT"

webhook_max_alerts

integer

Maximum number of alerts for webhook.

webhook_message

string

Message to send via webhook.

webhook_password

string

Password for webhook authentication.

webhook_title

string

Title of the webhook message.

webhook_url

string

URL for webhook.

Required when type is webhook.

webhook_username

string

Username for webhook authentication.

wecom_agent_id

string

Agent ID for WeCom.

Required when type is wecom.

wecom_corp_id

string

Corporate ID for WeCom.

Required when type is wecom.

wecom_message

string

Message to send via WeCom.

wecom_msg_type

string

Message type for WeCom.

wecom_secret

string

Secret for WeCom authentication.

Required when type is wecom.

wecom_title

string

Title of the WeCom message.

wecom_to_user

list / elements=string

List of users to send the WeCom message to.

wecom_url

string

URL for WeCom webhook.

Required when type is wecom.

Examples

- name: Create email contact point
  community.grafana.grafana_contact_point:
    grafana_url: "{{ grafana_url }}"
    grafana_user: "{{ grafana_username }}"
    grafana_password: "{{ grafana_password }}"
    uid: email
    name: E-Mail
    type: email
    email_addresses:
      - example@example.com

- name: Delete email contact point
  community.grafana.grafana_contact_point:
    grafana_url: "{{ grafana_url }}"
    grafana_user: "{{ grafana_username }}"
    grafana_password: "{{ grafana_password }}"
    uid: email
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

contact_point

complex

Contact point created or updated by the module.

Returned: success

disableResolveMessage

boolean

Is the resolve message of the contact point disabled.

Returned: success

Sample: [false]

name

string

The name of the contact point.

Returned: success

Sample: "['supportmail']"

secureFields

dictionary

The secure fields config of the contact point.

Returned: success

settings

dictionary

The type specific settings of the contact point.

Returned: success

Sample: [{"addresses": "support@example.com", "singleEmail": false}]

type

string

The type of the contact point.

Returned: success

Sample: "['email']"

uid

string

The uid of the contact point.

Returned: success

Sample: "['ddmyrs0f74t8hc']"

diff

complex

Difference between previous and updated contact point.

Returned: changed

after

dictionary

Current contact point.

Returned: changed

Sample: [{"disableResolveMessage": true, "name": "supportmail", "secureFields": {}, "settings": {"addresses": "support123@example.com", "singleEmail": false}, "type": "email", "uid": "ddmyrs0f74t8hc"}]

before

dictionary

Previous contact point.

Returned: changed

Sample: [{"disableResolveMessage": false, "name": "supportmail", "secureFields": {}, "settings": {"addresses": "support@example.com", "singleEmail": false}, "type": "email", "uid": "ddmyrs0f74t8hc"}]

Authors

  • Moritz Pötschk (@nemental)