Skip to content

Commit

Permalink
Add initial notification channel support
Browse files Browse the repository at this point in the history
  • Loading branch information
amenzhinsky authored and rrey committed Nov 16, 2020
1 parent 8644da8 commit d239cbe
Show file tree
Hide file tree
Showing 21 changed files with 1,534 additions and 0 deletions.
815 changes: 815 additions & 0 deletions plugins/modules/grafana_notification_channel.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

grafana_url: "http://grafana:3000"
grafana_username: "admin"
grafana_password: "admin"

...
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create dingding notification channel
register: result
grafana_notification_channel:
uid: dingding
name: dingding
type: dingding
dingding_url: https://example.org
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete dingding notification channel
register: result
grafana_notification_channel:
uid: dingding
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create discord notification channel
register: result
grafana_notification_channel:
uid: discord
name: discord
type: discord
discord_url: https://example.org
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete discord notification channel
register: result
grafana_notification_channel:
uid: discord
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
- name: Create email notification channel
register: result
grafana_notification_channel:
uid: email
name: email
type: email
email_addresses:
- foo@example.org
- bar@example.org
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete discord notification channel
register: result
grafana_notification_channel:
uid: email
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create googlechat notification channel
register: result
grafana_notification_channel:
uid: googlechat
name: googlechat
type: googlechat
googlechat_url: https://example.org
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete googlechat notification channel
register: result
grafana_notification_channel:
uid: googlechat
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create hipchat notification channel
register: result
grafana_notification_channel:
uid: hipchat
name: hipchat
type: hipchat
hipchat_url: https://example.org
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete hipchat notification channel
register: result
grafana_notification_channel:
uid: hipchat
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: Create kafka notification channel
register: result
grafana_notification_channel:
uid: kafka
name: kafka
type: kafka
kafka_url: https://example.org
kafka_topic: test
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete kafka notification channel
register: result
grafana_notification_channel:
uid: kafka
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create line notification channel
register: result
grafana_notification_channel:
uid: line
name: line
type: line
line_token: xxx
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete line notification channel
register: result
grafana_notification_channel:
uid: line
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- block:
# - include: dingding.yml
# - include: discord.yml
# - include: email.yml
# - include: googlechat.yml
# - include: hipchat.yml
# - include: kafka.yml
# - include: line.yml
# - include: teams.yml
# - include: opsgenie.yml
# - include: pagerduty.yml
# - include: prometheus.yml
# - include: pushover.yml
# - include: sensu.yml
- include: slack-and-beyond.yml
- include: telegram.yml
- include: threema.yml
- include: victorops.yml
- include: webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- name: Create opsgenie notification channel
register: result
grafana_notification_channel:
uid: opsgenie
name: opsgenie
type: opsgenie
opsgenie_url: https://example.org
opsgenie_api_key: xxx
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete opsgenie notification channel
register: result
grafana_notification_channel:
uid: opsgenie
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Create pagerduty notification channel
register: result
grafana_notification_channel:
uid: pagerduty
name: pagerduty
type: pagerduty
pagerduty_integration_key: xxx
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'present'"

- name: Delete pagerduty notification channel
register: result
grafana_notification_channel:
uid: pagerduty
state: absent
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password}}"

- debug:
var: result

- assert:
that:
- "result.changed == True"
- "result.state == 'absent'"
Loading

0 comments on commit d239cbe

Please sign in to comment.