diff --git a/changelogs/fragments/349-role-notification-channel.yml b/changelogs/fragments/349-role-notification-channel.yml new file mode 100644 index 00000000..f2428c3a --- /dev/null +++ b/changelogs/fragments/349-role-notification-channel.yml @@ -0,0 +1,4 @@ +--- + +minor_changes: + - added `community.grafana.notification_channel` to role diff --git a/roles/grafana/README.md b/roles/grafana/README.md index b839e7c9..f46434ed 100644 --- a/roles/grafana/README.md +++ b/roles/grafana/README.md @@ -95,6 +95,74 @@ Configure Grafana organizations, dashboards, folders, datasources, teams and use | org_name | no | | role | no | | state | no | +| [**grafana_notification_channel**](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_notification_channel_module.html) | +| dingding_message_type | no | +| dingding_url | no | +| disable_resolve_message | no | +| discord_message_content | no | +| discord_url | no | +| email_addresses | no | +| email_single | no | +| googlechat_url | no | +| hipchat_api_key | no | +| hipchat_room_id | no | +| hipchat_url | no | +| include_image | no | +| is_default | no | +| kafka_topic | no | +| kafka_url | no | +| line_token | no | +| name | yes | +| opsgenie_api_key | no | +| opsgenie_auto_close | no | +| opsgenie_override_priority | no | +| opsgenie_url | no | +| org_id | no | +| pagerduty_auto_resolve | no | +| pagerduty_integration_key | no | +| pagerduty_message_in_details | no | +| pagerduty_severity | no | +| prometheus_password | no | +| prometheus_url | no | +| prometheus_username | no | +| pushover_alert_sound | no | +| pushover_api_token | no | +| pushover_devices | no | +| pushover_expire | no | +| pushover_ok_sound | no | +| pushover_priority | no | +| pushover_retry | no | +| pushover_user_key | no | +| reminder_frequency | no | +| sensu_handler | no | +| sensu_password | no | +| sensu_source | no | +| sensu_url | no | +| sensu_username | no | +| slack_icon_emoji | no | +| slack_icon_url | no | +| slack_mention_channel | no | +| slack_mention_groups | no | +| slack_mention_users | no | +| slack_recipient | no | +| slack_token | no | +| slack_url | no | +| slack_username | no | +| state | no | +| teams_url | no | +| telegram_bot_token | no | +| telegram_chat_id | no | +| threema_api_secret | no | +| threema_gateway_id | no | +| threema_recipient_id | no | +| type | yes | +| uid | no | +| victorops_auto_resolve | no | +| victorops_url | no | +| webhook_http_method | no | +| webhook_password | no | +| webhook_url | no | +| webhook_username | no | ## Example Playbook diff --git a/roles/grafana/defaults/main.yml b/roles/grafana/defaults/main.yml index d23719c5..6a84370d 100644 --- a/roles/grafana/defaults/main.yml +++ b/roles/grafana/defaults/main.yml @@ -6,3 +6,4 @@ grafana_teams: [] grafana_datasources: [] grafana_folders: [] grafana_dashboards: [] +grafana_notification_channels: [] diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml index 1f04e68a..82bbc633 100644 --- a/roles/grafana/tasks/main.yml +++ b/roles/grafana/tasks/main.yml @@ -16,6 +16,79 @@ loop_control: {loop_var: organization} tags: organization + - name: Manage notification channel + community.grafana.grafana_notification_channel: + dingding_message_type: "{{ notification_channel.dingding_message_type | default(omit) }}" + dingding_url: "{{ notification_channel.dingding_url | default(omit) }}" + disable_resolve_message: "{{ notification_channel.disable_resolve_message | default(omit) }}" + discord_message_content: "{{ notification_channel.discord_message_content | default(omit) }}" + discord_url: "{{ notification_channel.discord_url | default(omit) }}" + email_addresses: "{{ notification_channel.email_addresses | default(omit) }}" + email_single: "{{ notification_channel.email_single | default(omit) }}" + googlechat_url: "{{ notification_channel.googlechat_url | default(omit) }}" + hipchat_api_key: "{{ notification_channel.hipchat_api_key | default(omit) }}" + hipchat_room_id: "{{ notification_channel.hipchat_room_id | default(omit) }}" + hipchat_url: "{{ notification_channel.hipchat_url | default(omit) }}" + include_image: "{{ notification_channel.include_image | default(omit) }}" + is_default: "{{ notification_channel.is_default | default(omit) }}" + kafka_topic: "{{ notification_channel.kafka_topic | default(omit) }}" + kafka_url: "{{ notification_channel.kafka_url | default(omit) }}" + line_token: "{{ notification_channel.line_token | default(omit) }}" + name: "{{ notification_channel.name }}" + opsgenie_api_key: "{{ notification_channel.opsgenie_api_key | default(omit) }}" + opsgenie_auto_close: "{{ notification_channel.opsgenie_auto_close | default(omit) }}" + opsgenie_override_priority: "{{ notification_channel.opsgenie_override_priority | default(omit) }}" + opsgenie_url: "{{ notification_channel.opsgenie_url | default(omit) }}" + org_id: "{{ notification_channel.org_id | default(omit) }}" + pagerduty_auto_resolve: "{{ notification_channel.pagerduty_auto_resolve | default(omit) }}" + pagerduty_integration_key: "{{ notification_channel.pagerduty_integration_key | default(omit) }}" + pagerduty_message_in_details: "{{ notification_channel.pagerduty_message_in_details | default(omit) }}" + pagerduty_severity: "{{ notification_channel.pagerduty_severity | default(omit) }}" + prometheus_password: "{{ notification_channel.prometheus_password | default(omit) }}" + prometheus_url: "{{ notification_channel.prometheus_url | default(omit) }}" + prometheus_username: "{{ notification_channel.prometheus_username | default(omit) }}" + pushover_alert_sound: "{{ notification_channel.pushover_alert_sound | default(omit) }}" + pushover_api_token: "{{ notification_channel.pushover_api_token | default(omit) }}" + pushover_devices: "{{ notification_channel.pushover_devices | default(omit) }}" + pushover_expire: "{{ notification_channel.pushover_expire | default(omit) }}" + pushover_ok_sound: "{{ notification_channel.pushover_ok_sound | default(omit) }}" + pushover_priority: "{{ notification_channel.pushover_priority | default(omit) }}" + pushover_retry: "{{ notification_channel.pushover_retry | default(omit) }}" + pushover_user_key: "{{ notification_channel.pushover_user_key | default(omit) }}" + reminder_frequency: "{{ notification_channel.reminder_frequency | default(omit) }}" + sensu_handler: "{{ notification_channel.sensu_handler | default(omit) }}" + sensu_password: "{{ notification_channel.sensu_password | default(omit) }}" + sensu_source: "{{ notification_channel.sensu_source | default(omit) }}" + sensu_url: "{{ notification_channel.sensu_url | default(omit) }}" + sensu_username: "{{ notification_channel.sensu_username | default(omit) }}" + slack_icon_emoji: "{{ notification_channel.slack_icon_emoji | default(omit) }}" + slack_icon_url: "{{ notification_channel.slack_icon_url | default(omit) }}" + slack_mention_channel: "{{ notification_channel.slack_mention_channel | default(omit) }}" + slack_mention_groups: "{{ notification_channel.slack_mention_groups | default(omit) }}" + slack_mention_users: "{{ notification_channel.slack_mention_users | default(omit) }}" + slack_recipient: "{{ notification_channel.slack_recipient | default(omit) }}" + slack_token: "{{ notification_channel.slack_token | default(omit) }}" + slack_url: "{{ notification_channel.slack_url | default(omit) }}" + slack_username: "{{ notification_channel.slack_username | default(omit) }}" + state: "{{ notification_channel.state | default(omit) }}" + teams_url: "{{ notification_channel.teams_url | default(omit) }}" + telegram_bot_token: "{{ notification_channel.telegram_bot_token | default(omit) }}" + telegram_chat_id: "{{ notification_channel.telegram_chat_id | default(omit) }}" + threema_api_secret: "{{ notification_channel.threema_api_secret | default(omit) }}" + threema_gateway_id: "{{ notification_channel.threema_gateway_id | default(omit) }}" + threema_recipient_id: "{{ notification_channel.threema_recipient_id | default(omit) }}" + type: "{{ notification_channel.type }}" + uid: "{{ notification_channel.uid | default(omit) }}" + victorops_auto_resolve: "{{ notification_channel.victorops_auto_resolve | default(omit) }}" + victorops_url: "{{ notification_channel.victorops_url | default(omit) }}" + webhook_http_method: "{{ notification_channel.webhook_http_method | default(omit) }}" + webhook_password: "{{ notification_channel.webhook_password | default(omit) }}" + webhook_url: "{{ notification_channel.webhook_url | default(omit) }}" + webhook_username: "{{ notification_channel.webhook_username | default(omit) }}" + loop: "{{ grafana_notification_channels }}" + loop_control: {loop_var: notification_channel} + tags: notification_channel + - name: Manage datasource community.grafana.grafana_datasource: access: "{{ datasource.access | default(omit) }}"