summaryrefslogtreecommitdiffstats
path: root/collections-debian-merged/ansible_collections/community/grafana/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'collections-debian-merged/ansible_collections/community/grafana/tests/integration')
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/aliases1
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/defaults/main.yml7
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/files/dashboard.json85
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-file.yml44
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-id.yml40
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-url.yml39
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/delete-dashboard.yml16
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/main.yml5
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/aliases1
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/defaults/main.yml7
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/cloudwatch.yml127
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/elastic.yml289
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/influx.yml100
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/loki.yml88
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/main.yml12
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/postgres.yml107
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/thruk.yml88
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/zabbix.yml126
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/defaults/main.yml7
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/tasks/main.yml55
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/defaults/main.yml7
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/dingding.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/discord.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/email.yml38
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/googlechat.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/hipchat.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/kafka.yml37
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/line.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/main.yml20
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/opsgenie.yml37
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pagerduty.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/prometheus.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pushover.yml37
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/sensu.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/slack-and-beyond.yml72
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/teams.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/telegram.yml37
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/threema.yml38
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/victorops.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/webhook.yml36
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/defaults/main.yml7
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/create_user.yml29
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/main.yml171
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/defaults/main.yml4
-rw-r--r--collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/tasks/main.yml97
45 files changed, 2271 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/aliases b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/aliases
new file mode 100644
index 00000000..a6dafcf8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/aliases
@@ -0,0 +1 @@
+shippable/posix/group1
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/defaults/main.yml
new file mode 100644
index 00000000..500c1bb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/files/dashboard.json b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/files/dashboard.json
new file mode 100644
index 00000000..70287fa7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/files/dashboard.json
@@ -0,0 +1,85 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": "-- Grafana --",
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "gnetId": null,
+ "graphTooltip": 0,
+ "id": 11,
+ "links": [],
+ "panels": [
+ {
+ "content": "\n# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)\n\n\n\n",
+ "gridPos": {
+ "h": 9,
+ "w": 12,
+ "x": 0,
+ "y": 0
+ },
+ "id": 2,
+ "mode": "markdown",
+ "options": {},
+ "targets": [
+ {
+ "expr": "",
+ "format": "time_series",
+ "intervalFactor": 1,
+ "refId": "A"
+ }
+ ],
+ "timeFrom": null,
+ "timeShift": null,
+ "title": "Panel Title",
+ "type": "text"
+ }
+ ],
+ "schemaVersion": 18,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": []
+ },
+ "time": {
+ "from": "now-6h",
+ "to": "now"
+ },
+ "timepicker": {
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "timezone": "",
+ "title": "test",
+ "uid": "9ZlJIhhWk",
+ "version": 7
+ } \ No newline at end of file
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-file.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-file.yml
new file mode 100644
index 00000000..93df1666
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-file.yml
@@ -0,0 +1,44 @@
+---
+- name: copy dashboard file
+ copy:
+ src: "files/dashboard.json"
+ dest: "/tmp/dashboard.json"
+
+
+- name: Check import grafana dashboard from file
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ path: /tmp/dashboard.json
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.msg == 'Dashboard test created'"
+
+- name: Check import grafana dashboard from file idempotency
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ path: /tmp/dashboard.json
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.msg == 'Dashboard test unchanged.'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-id.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-id.yml
new file mode 100644
index 00000000..3b81ebf7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-id.yml
@@ -0,0 +1,40 @@
+---
+- name: Check import grafana dashboard from id
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ dashboard_id: "6098"
+ dashboard_revision: "1"
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.msg == 'Dashboard Zabbix Host Status created'"
+
+- name: Check import grafana dashboard from id idempotency
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ dashboard_id: "6098"
+ dashboard_revision: "1"
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.msg == 'Dashboard Zabbix Host Status unchanged.'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-url.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-url.yml
new file mode 100644
index 00000000..5146fc9a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-url.yml
@@ -0,0 +1,39 @@
+---
+
+- name: Check import grafana dashboard from url
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.msg == 'Dashboard Zabbix Host Status created'"
+
+- name: Check import grafana dashboard from url idempotency
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: present
+ commit_message: Updated by ansible
+ dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download
+ overwrite: true
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.msg == 'Dashboard Zabbix Host Status unchanged.'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/delete-dashboard.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/delete-dashboard.yml
new file mode 100644
index 00000000..2013324f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/delete-dashboard.yml
@@ -0,0 +1,16 @@
+- name: Check delete dashboard is working
+ grafana_dashboard:
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ state: absent
+ uid: "{{ result.uid }}"
+ register: result
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.msg == 'Dashboard {{ result.uid }} deleted'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/main.yml
new file mode 100644
index 00000000..dd348a2a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/main.yml
@@ -0,0 +1,5 @@
+- block:
+ - include: dashboard-from-url.yml
+ - include: delete-dashboard.yml
+ - include: dashboard-from-id.yml
+ - include: dashboard-from-file.yml
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/aliases b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/aliases
new file mode 100644
index 00000000..a6dafcf8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/aliases
@@ -0,0 +1 @@
+shippable/posix/group1
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/defaults/main.yml
new file mode 100644
index 00000000..500c1bb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/cloudwatch.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/cloudwatch.yml
new file mode 100644
index 00000000..9e778342
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/cloudwatch.yml
@@ -0,0 +1,127 @@
+- name: Create cloudwatch datasource
+ register: result
+ grafana_datasource:
+ name: datasource-cloudwatch
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: cloudwatch
+ ds_url: http://monitoring.us-west-1.amazonaws.com
+ aws_auth_type: keys
+ aws_default_region: us-west-1
+ aws_access_key: speakFriendAndEnter
+ aws_secret_key: mel10n
+ aws_custom_metrics_namespaces: n1,n2
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-cloudwatch created'"
+ - result.datasource.access == 'proxy'
+ - result.datasource.basicAuth == false
+ - result.datasource.database == ''
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.authType == 'keys'
+ - result.datasource.jsonData.customMetricsNamespaces == 'n1,n2'
+ - result.datasource.jsonData.defaultRegion == 'us-west-1'
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.name == 'datasource-cloudwatch'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'cloudwatch'
+ - result.datasource.url == 'http://monitoring.us-west-1.amazonaws.com'
+ - result.datasource.user == ''
+ - result.datasource.withCredentials == false
+
+- name: Check cloudwatch datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-cloudwatch
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: cloudwatch
+ ds_url: http://monitoring.us-west-1.amazonaws.com
+ aws_auth_type: keys
+ aws_default_region: us-west-1
+ aws_access_key: speakFriendAndEnter
+ aws_secret_key: mel10n
+ aws_custom_metrics_namespaces: n1,n2
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.access == 'proxy'
+ - result.datasource.basicAuth == false
+ - result.datasource.database == ''
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.authType == 'keys'
+ - result.datasource.jsonData.customMetricsNamespaces == 'n1,n2'
+ - result.datasource.jsonData.defaultRegion == 'us-west-1'
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.name == 'datasource-cloudwatch'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'cloudwatch'
+ - result.datasource.url == 'http://monitoring.us-west-1.amazonaws.com'
+ - result.datasource.user == ''
+ - result.datasource.withCredentials == false
+
+- name: Delete cloudwatch datasource
+ register: result
+ grafana_datasource:
+ name: datasource-cloudwatch
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: cloudwatch
+ ds_url: http://monitoring.us-west-1.amazonaws.com
+ aws_auth_type: keys
+ aws_default_region: us-west-1
+ aws_access_key: speakFriendAndEnter
+ aws_secret_key: mel10n
+ aws_custom_metrics_namespaces: n1,n2
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-cloudwatch deleted.'"
+
+- name: Delete cloudwatch datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-cloudwatch
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: cloudwatch
+ ds_url: http://monitoring.us-west-1.amazonaws.com
+ aws_auth_type: keys
+ aws_default_region: us-west-1
+ aws_access_key: speakFriendAndEnter
+ aws_secret_key: mel10n
+ aws_custom_metrics_namespaces: n1,n2
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/elastic.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/elastic.yml
new file mode 100644
index 00000000..9185a2d9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/elastic.yml
@@ -0,0 +1,289 @@
+- name: Create elasticsearch datasource
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.company.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - result.datasource.basicAuth
+ - result.datasource.basicAuthUser == 'grafana'
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == '[logstash_]YYYY.MM.DD'
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.esVersion == 56
+ - result.datasource.jsonData.interval == 'Daily'
+ - result.datasource.jsonData.maxConcurrentShardRequests == 42
+ - result.datasource.jsonData.timeField == '@timestamp'
+ - not result.datasource.jsonData.tlsAuth
+ - not result.datasource.jsonData.tlsAuthWithCACert
+ - result.datasource.name == 'datasource-elastic'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'elasticsearch'
+ - result.datasource.url == 'https://elastic.company.com:9200'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+ - "result.msg == 'Datasource datasource-elastic created'"
+
+- name: Check elasticsearch datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.company.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.basicAuth
+ - result.datasource.basicAuthUser == 'grafana'
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == '[logstash_]YYYY.MM.DD'
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.esVersion == 56
+ - result.datasource.jsonData.interval == 'Daily'
+ - result.datasource.jsonData.maxConcurrentShardRequests == 42
+ - result.datasource.jsonData.timeField == '@timestamp'
+ - not result.datasource.jsonData.tlsAuth
+ - not result.datasource.jsonData.tlsAuthWithCACert
+ - result.datasource.name == 'datasource-elastic'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'elasticsearch'
+ - result.datasource.url == 'https://elastic.company.com:9200'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+
+- name: update elasticsearch datasource creation
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.example.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - result.datasource.basicAuth
+ - result.datasource.basicAuthUser == 'grafana'
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == '[logstash_]YYYY.MM.DD'
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.esVersion == 56
+ - result.datasource.jsonData.interval == 'Daily'
+ - result.datasource.jsonData.maxConcurrentShardRequests == 42
+ - result.datasource.jsonData.timeField == '@timestamp'
+ - not result.datasource.jsonData.tlsAuth
+ - not result.datasource.jsonData.tlsAuthWithCACert
+ - result.datasource.name == 'datasource-elastic'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'elasticsearch'
+ - result.datasource.url == 'https://elastic.example.com:9200'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+
+- name: update elasticsearch datasource (ignoring secureJsonData)
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.example.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ enforce_secure_data: false
+ additional_json_data:
+ nonSecureTest: "nonsecure"
+ additional_secure_json_data:
+ secureTest: "secure"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - result.datasource.basicAuth
+ - result.datasource.basicAuthUser == 'grafana'
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == '[logstash_]YYYY.MM.DD'
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.esVersion == 56
+ - result.datasource.jsonData.interval == 'Daily'
+ - result.datasource.jsonData.maxConcurrentShardRequests == 42
+ - result.datasource.jsonData.timeField == '@timestamp'
+ - not result.datasource.jsonData.tlsAuth
+ - not result.datasource.jsonData.tlsAuthWithCACert
+ - result.datasource.name == 'datasource-elastic'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'elasticsearch'
+ - result.datasource.url == 'https://elastic.example.com:9200'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+ - result.datasource.jsonData.nonSecureTest == 'nonsecure'
+
+- name: update elasticsearch datasource (including secureJsonData)
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.example.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ enforce_secure_data: true
+ additional_json_data:
+ nonSecureTest: "nonsecure"
+ additional_secure_json_data:
+ secureTest: "secure"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - result.datasource.basicAuth
+ - result.datasource.basicAuthUser == 'grafana'
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == '[logstash_]YYYY.MM.DD'
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.esVersion == 56
+ - result.datasource.jsonData.interval == 'Daily'
+ - result.datasource.jsonData.maxConcurrentShardRequests == 42
+ - result.datasource.jsonData.timeField == '@timestamp'
+ - not result.datasource.jsonData.tlsAuth
+ - not result.datasource.jsonData.tlsAuthWithCACert
+ - result.datasource.name == 'datasource-elastic'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'elasticsearch'
+ - result.datasource.url == 'https://elastic.example.com:9200'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+ - result.datasource.jsonData.nonSecureTest == 'nonsecure'
+ - result.datasource.secureJsonFields.secureTest == true
+ - result.diff.after.secureJsonData is defined
+
+- name: Delete elasticsearch datasource
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.company.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- assert:
+ that:
+ - result.changed
+
+- name: Delete elasticsearch datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-elastic
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: elasticsearch
+ ds_url: https://elastic.company.com:9200
+ database: '[logstash_]YYYY.MM.DD'
+ basic_auth_user: grafana
+ basic_auth_password: '******'
+ time_field: '@timestamp'
+ time_interval: 1m
+ interval: Daily
+ es_version: 56
+ max_concurrent_shard_requests: 42
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/influx.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/influx.yml
new file mode 100644
index 00000000..2ef6a278
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/influx.yml
@@ -0,0 +1,100 @@
+- name: Create influxdb datasource
+ register: result
+ grafana_datasource:
+ name: datasource-influxdb
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: influxdb
+ ds_url: https://influx.company.com:8086
+ database: telegraf
+ time_interval: '>10s'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-influxdb created'"
+
+- name: Check influxdb datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-influxdb
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: influxdb
+ ds_url: https://influx.company.com:8086
+ database: telegraf
+ time_interval: '>10s'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.basicAuth == false
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == 'telegraf'
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.timeInterval == '>10s'
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.name == 'datasource-influxdb'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'influxdb'
+ - result.datasource.url == 'https://influx.company.com:8086'
+ - result.datasource.user == ''
+ - result.datasource.withCredentials == false
+
+- name: Delete influxdb datasource
+ register: result
+ grafana_datasource:
+ name: datasource-influxdb
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: influxdb
+ ds_url: https://influx.company.com:8086
+ database: telegraf
+ time_interval: '>10s'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+
+- name: Delete influxdb datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-influxdb
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: influxdb
+ ds_url: https://influx.company.com:8086
+ database: telegraf
+ time_interval: '>10s'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/loki.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/loki.yml
new file mode 100644
index 00000000..728da609
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/loki.yml
@@ -0,0 +1,88 @@
+- name: Create loki datasource
+ register: result
+ grafana_datasource:
+ name: datasource-loki
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: loki
+ ds_url: https://loki.company.com:3100
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-loki created'"
+
+- name: Check loki datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-loki
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: loki
+ ds_url: https://loki.company.com:3100
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.basicAuth == false
+ - result.datasource.access == 'proxy'
+ - result.datasource.database == ''
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.name == 'datasource-loki'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'loki'
+ - result.datasource.url == 'https://loki.company.com:3100'
+ - result.datasource.user == ''
+ - result.datasource.withCredentials == false
+
+- name: Delete loki datasource
+ register: result
+ grafana_datasource:
+ name: datasource-loki
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: loki
+ ds_url: https://loki.company.com:3100
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-loki deleted.'"
+
+- name: Delete loki datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-loki
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+ org_id: '1'
+ ds_type: loki
+ ds_url: https://loki.company.com:3100
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/main.yml
new file mode 100644
index 00000000..c5e5ab2d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+
+- block:
+ - include: elastic.yml
+ - include: influx.yml
+ - include: postgres.yml
+ - include: cloudwatch.yml
+ - include: thruk.yml
+ - include: loki.yml
+ - include: zabbix.yml
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/postgres.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/postgres.yml
new file mode 100644
index 00000000..5712a41f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/postgres.yml
@@ -0,0 +1,107 @@
+- name: Create postgres datasource
+ register: result
+ grafana_datasource:
+ name: datasource-postgres
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: postgres
+ ds_url: postgres.company.com:5432
+ database: db
+ user: postgres
+ password: iampgroot
+ sslmode: verify-full
+ additional_json_data:
+ timescaledb: true
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-postgres created'"
+
+- name: Check postgres datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-postgres
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: postgres
+ ds_url: postgres.company.com:5432
+ database: db
+ user: postgres
+ password: iampgroot
+ sslmode: verify-full
+ additional_json_data:
+ timescaledb: true
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.basicAuth == false
+ - result.datasource.database == 'db'
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.sslmode == 'verify-full'
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.jsonData.timescaledb == true
+ - result.datasource.name == 'datasource-postgres'
+ - result.datasource.orgId == 1
+ - result.datasource.type == 'postgres'
+ - result.datasource.url == 'postgres.company.com:5432'
+ - result.datasource.user == 'postgres'
+ - result.datasource.withCredentials == false
+
+- name: Delete postgres datasource
+ register: result
+ grafana_datasource:
+ name: datasource-postgres
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: postgres
+ ds_url: postgres.company.com:5432
+ database: db
+ user: postgres
+ password: iampgroot
+ sslmode: verify-full
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+
+- name: Delete postgres datasource
+ register: result
+ grafana_datasource:
+ name: datasource-postgres
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: postgres
+ ds_url: postgres.company.com:5432
+ database: db
+ user: postgres
+ password: iampgroot
+ sslmode: verify-full
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/thruk.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/thruk.yml
new file mode 100644
index 00000000..50b7e31d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/thruk.yml
@@ -0,0 +1,88 @@
+- name: Create thruk datasource
+ register: result
+ grafana_datasource:
+ name: datasource-thruk
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: "1"
+ ds_type: sni-thruk-datasource
+ ds_url: "https://thruk.company.com/sitename/thruk"
+ tls_skip_verify: yes
+ validate_certs: no
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - "result.msg == 'Datasource datasource-thruk created'"
+
+- name: Check thruk datasource creation idempotency
+ register: result
+ grafana_datasource:
+ name: datasource-thruk
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: sni-thruk-datasource
+ ds_url: "https://thruk.company.com/sitename/thruk"
+ tls_skip_verify: yes
+ validate_certs: no
+
+- assert:
+ that:
+ - not result.changed
+ - result.datasource.basicAuth == false
+ - result.datasource.access == 'proxy'
+ - result.datasource.isDefault == false
+ - result.datasource.jsonData.tlsAuth == false
+ - result.datasource.jsonData.tlsAuthWithCACert == false
+ - result.datasource.name == 'datasource-thruk'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'sni-thruk-datasource'
+ - result.datasource.url == 'https://thruk.company.com/sitename/thruk'
+ - result.datasource.user == ''
+ - result.datasource.withCredentials == false
+
+- name: Delete thruk datasource
+ register: result
+ grafana_datasource:
+ name: datasource-thruk
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: "1"
+ ds_type: sni-thruk-datasource
+ ds_url: "https://thruk.company.com/sitename/thruk"
+ tls_skip_verify: yes
+ validate_certs: no
+ state: absent
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+
+- name: Delete thruk datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-thruk
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: "1"
+ ds_type: sni-thruk-datasource
+ ds_url: "https://thruk.company.com/sitename/thruk"
+ tls_skip_verify: yes
+ validate_certs: no
+ state: absent
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/zabbix.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/zabbix.yml
new file mode 100644
index 00000000..b4e494e1
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/zabbix.yml
@@ -0,0 +1,126 @@
+- name: Create zabbix datasource
+ register: result
+ grafana_datasource:
+ name: datasource-zabbix
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: alexanderzobnin-zabbix-datasource
+ ds_url: https://zabbix.company.com
+ zabbix_user: grafana
+ zabbix_password: '******'
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.username == 'grafana'
+ - result.datasource.name == 'datasource-zabbix'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'alexanderzobnin-zabbix-datasource'
+ - result.datasource.url == 'https://zabbix.company.com'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+ - "result.msg == 'Datasource datasource-zabbix created'"
+
+- name: Create zabbix datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-zabbix
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: alexanderzobnin-zabbix-datasource
+ ds_url: https://zabbix.company.com
+ zabbix_user: grafana
+ zabbix_password: '******'
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - not result.changed
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.username == 'grafana'
+ - result.datasource.name == 'datasource-zabbix'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'alexanderzobnin-zabbix-datasource'
+ - result.datasource.url == 'https://zabbix.company.com'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+
+- name: Update zabbix datasource
+ register: result
+ grafana_datasource:
+ name: datasource-zabbix
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: alexanderzobnin-zabbix-datasource
+ ds_url: https://zabbix.example.com
+ zabbix_user: grafana
+ zabbix_password: '******'
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - result.changed
+ - not result.datasource.isDefault
+ - result.datasource.jsonData.username == 'grafana'
+ - result.datasource.name == 'datasource-zabbix'
+ - result.datasource.orgId == 1
+ - result.datasource.password == ''
+ - result.datasource.type == 'alexanderzobnin-zabbix-datasource'
+ - result.datasource.url == 'https://zabbix.example.com'
+ - result.datasource.user == ''
+ - not result.datasource.withCredentials
+ - "result.msg == 'Datasource datasource-zabbix updated'"
+
+- name: Delete zabbix datasource
+ register: result
+ grafana_datasource:
+ name: datasource-zabbix
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: alexanderzobnin-zabbix-datasource
+ ds_url: https://zabbix.example.com
+ zabbix_user: grafana
+ zabbix_password: '******'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- assert:
+ that:
+ - result.changed
+
+- name: Delete zabbix datasource (idempotency)
+ register: result
+ grafana_datasource:
+ name: datasource-zabbix
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password }}"
+ org_id: '1'
+ ds_type: alexanderzobnin-zabbix-datasource
+ ds_url: https://zabbix.example.com
+ zabbix_user: grafana
+ zabbix_password: '******'
+ tls_ca_cert: /etc/ssl/certs/ca.pem
+ state: absent
+
+- assert:
+ that:
+ - not result.changed
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/defaults/main.yml
new file mode 100644
index 00000000..500c1bb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/tasks/main.yml
new file mode 100644
index 00000000..c6a52056
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_folder/tasks/main.yml
@@ -0,0 +1,55 @@
+---
+
+- name: Create a Folder
+ grafana_folder:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ title: "grafana_working_group"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.folder.title == 'grafana_working_group'"
+
+- name: Test folder creation idempotency
+ grafana_folder:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ title: "grafana_working_group"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.folder.title == 'grafana_working_group'"
+
+- name: Delete a Folder
+ grafana_folder:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ title: "grafana_working_group"
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: Test folder deletion idempotency
+ grafana_folder:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ title: "grafana_working_group"
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/defaults/main.yml
new file mode 100644
index 00000000..500c1bb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/dingding.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/dingding.yml
new file mode 100644
index 00000000..58cffbb0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/dingding.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/discord.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/discord.yml
new file mode 100644
index 00000000..917d96d9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/discord.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/email.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/email.yml
new file mode 100644
index 00000000..d224cf50
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/email.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/googlechat.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/googlechat.yml
new file mode 100644
index 00000000..f45516cf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/googlechat.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/hipchat.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/hipchat.yml
new file mode 100644
index 00000000..af8fed7f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/hipchat.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/kafka.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/kafka.yml
new file mode 100644
index 00000000..ca950414
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/kafka.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/line.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/line.yml
new file mode 100644
index 00000000..e8ba02ca
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/line.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/main.yml
new file mode 100644
index 00000000..5ea36676
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/main.yml
@@ -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
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/opsgenie.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/opsgenie.yml
new file mode 100644
index 00000000..bbf8617e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/opsgenie.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pagerduty.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pagerduty.yml
new file mode 100644
index 00000000..d2b09f1a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pagerduty.yml
@@ -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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/prometheus.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/prometheus.yml
new file mode 100644
index 00000000..e42868e5
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/prometheus.yml
@@ -0,0 +1,36 @@
+---
+- name: Create prometheus notification channel
+ register: result
+ grafana_notification_channel:
+ uid: prometheus
+ name: prometheus
+ type: prometheus
+ prometheus_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 prometheus notification channel
+ register: result
+ grafana_notification_channel:
+ uid: prometheus
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pushover.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pushover.yml
new file mode 100644
index 00000000..0fe04d55
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/pushover.yml
@@ -0,0 +1,37 @@
+---
+- name: Create pushover notification channel
+ register: result
+ grafana_notification_channel:
+ uid: pushover
+ name: pushover
+ type: pushover
+ pushover_api_token: xxx
+ pushover_user_key: yyy
+ 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 pushover notification channel
+ register: result
+ grafana_notification_channel:
+ uid: pushover
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/sensu.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/sensu.yml
new file mode 100644
index 00000000..eaf7ad8a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/sensu.yml
@@ -0,0 +1,36 @@
+---
+- name: Create sensu notification channel
+ register: result
+ grafana_notification_channel:
+ uid: sensu
+ name: sensu
+ type: sensu
+ sensu_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 sensu notification channel
+ register: result
+ grafana_notification_channel:
+ uid: sensu
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/slack-and-beyond.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/slack-and-beyond.yml
new file mode 100644
index 00000000..db9efe3b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/slack-and-beyond.yml
@@ -0,0 +1,72 @@
+---
+- 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}}"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == True"
+ - "result.state == 'present'"
+
+- name: Check slack notification channel idempotency
+ 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}}"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == False"
+
+- name: Update slack notification channel
+ register: result
+ grafana_notification_channel:
+ uid: slack
+ name: slack
+ type: slack
+ slack_url: https://hooks.slack.com/services/xxx/yyy/fff
+ grafana_url: "{{ grafana_url }}"
+ grafana_user: "{{ grafana_username }}"
+ grafana_password: "{{ grafana_password}}"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == True"
+
+- 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}}"
+
+- debug:
+ var: result
+
+- assert:
+ that:
+ - "result.changed == True"
+ - "result.state == 'absent'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/teams.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/teams.yml
new file mode 100644
index 00000000..5f08ee9b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/teams.yml
@@ -0,0 +1,36 @@
+---
+- name: Create teams notification channel
+ register: result
+ grafana_notification_channel:
+ uid: teams
+ name: teams
+ type: teams
+ teams_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 teams notification channel
+ register: result
+ grafana_notification_channel:
+ uid: teams
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/telegram.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/telegram.yml
new file mode 100644
index 00000000..2841b336
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/telegram.yml
@@ -0,0 +1,37 @@
+---
+- name: Create telegram notification channel
+ register: result
+ grafana_notification_channel:
+ uid: telegram
+ name: telegram
+ type: telegram
+ telegram_bot_token: xxx
+ telegram_chat_id: yyy
+ 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 telegram notification channel
+ register: result
+ grafana_notification_channel:
+ uid: telegram
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/threema.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/threema.yml
new file mode 100644
index 00000000..1a21ff32
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/threema.yml
@@ -0,0 +1,38 @@
+---
+- name: Create threema notification channel
+ register: result
+ grafana_notification_channel:
+ uid: threema
+ name: threema
+ type: threema
+ threema_gateway_id: xxx
+ threema_recepient_id: yyy
+ threema_api_secret: zzz
+ 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 threema notification channel
+ register: result
+ grafana_notification_channel:
+ uid: threema
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/victorops.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/victorops.yml
new file mode 100644
index 00000000..b043d2cf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/victorops.yml
@@ -0,0 +1,36 @@
+---
+- name: Create victorops notification channel
+ register: result
+ grafana_notification_channel:
+ uid: victorops
+ name: victorops
+ type: victorops
+ victorops_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 victorops notification channel
+ register: result
+ grafana_notification_channel:
+ uid: victorops
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/webhook.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/webhook.yml
new file mode 100644
index 00000000..fc1cb56a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_notification_channel/tasks/webhook.yml
@@ -0,0 +1,36 @@
+---
+- name: Create webhook notification channel
+ register: result
+ grafana_notification_channel:
+ uid: webhook
+ name: webhook
+ type: webhook
+ webhook_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 webhook notification channel
+ register: result
+ grafana_notification_channel:
+ uid: webhook
+ 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'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/defaults/main.yml
new file mode 100644
index 00000000..500c1bb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
+
+...
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/create_user.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/create_user.yml
new file mode 100644
index 00000000..dfd0bac1
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/create_user.yml
@@ -0,0 +1,29 @@
+- name: Create John Doe for tests purpose through uri module
+ uri:
+ url: "{{ grafana_url }}/api/admin/users"
+ method: POST
+ user: "{{ grafana_username }}"
+ password: "{{ grafana_password }}"
+ force_basic_auth: yes
+ body:
+ name: "John"
+ email: "john.doe@example.com"
+ login: "john"
+ password: "userpassword"
+ body_format: json
+ status_code: 200
+
+- name: Create Jane Doe for tests purpose through uri module
+ uri:
+ url: "{{ grafana_url }}/api/admin/users"
+ method: POST
+ user: "{{ grafana_username }}"
+ password: "{{ grafana_password }}"
+ force_basic_auth: yes
+ body:
+ name: "Jane"
+ email: "jane.doe@example.com"
+ login: "jane"
+ password: "userpassword"
+ body_format: json
+ status_code: 200
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/main.yml
new file mode 100644
index 00000000..104d2281
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_team/tasks/main.yml
@@ -0,0 +1,171 @@
+---
+
+- name: Create a Team without members
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 0"
+ - "result.team.members == []"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Check idempotency on team creation
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 0"
+ - "result.team.members == []"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Check a team can be deleted
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.message == 'Team deleted'"
+
+- name: Check idempotency on team deletion
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.message == 'No team found'"
+
+- name: Create users for tests purpose
+ import_tasks: create_user.yml
+
+- name: Create a Team with members
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ members:
+ - "john.doe@example.com"
+ - "jane.doe@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 2"
+ - "result.team.members == ['jane.doe@example.com', 'john.doe@example.com']"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Ensure a Team exists with member not enforced
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ members:
+ - "john.doe@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 2"
+ - "result.team.members == ['jane.doe@example.com', 'john.doe@example.com']"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Ensure a Team exists with member enforced
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ members:
+ - "john.doe@example.com"
+ enforce_members: true
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 1"
+ - "result.team.members == ['john.doe@example.com']"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Ensure a Team exists with members omitted
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 1"
+ - "result.team.members == ['john.doe@example.com']"
+ - "result.team.email == 'foo.bar@example.com'"
+
+- name: Add new member to existing Team
+ grafana_team:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "grafana_working_group"
+ email: "foo.bar@example.com"
+ members:
+ - "john.doe@example.com"
+ - "jane.doe@example.com"
+ state: present
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.team.name == 'grafana_working_group'"
+ - "result.team.memberCount == 2"
+ - "result.team.members == ['jane.doe@example.com', 'john.doe@example.com']"
+ - "result.team.email == 'foo.bar@example.com'"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/defaults/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/defaults/main.yml
new file mode 100644
index 00000000..48d728e5
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+grafana_url: "http://grafana:3000"
+grafana_username: "admin"
+grafana_password: "admin"
diff --git a/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/tasks/main.yml b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/tasks/main.yml
new file mode 100644
index 00000000..d63b2b74
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/grafana/tests/integration/targets/grafana_user/tasks/main.yml
@@ -0,0 +1,97 @@
+---
+- name: Create a Grafana user without password (expect failure)
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "Bruce Wayne"
+ email: batman@gotham.city
+ login: batman
+ state: present
+ register: result
+ ignore_errors: yes
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.failed == true"
+ - "result.msg == 'missing required arguments: password'"
+
+- name: Create a Grafana user
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "Bruce Wayne"
+ email: batman@gotham.city
+ login: batman
+ password: robin
+ state: present
+ register: result
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.user.name == 'Bruce Wayne'"
+ - "result.user.email == 'batman@gotham.city'"
+ - "result.user.isGrafanaAdmin == false"
+
+- name: Check idempotency on user creation (password not requiered)
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "Bruce Wayne"
+ email: batman@gotham.city
+ login: batman
+ state: present
+ register: result
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.user.name == 'Bruce Wayne'"
+ - "result.user.email == 'batman@gotham.city'"
+ - "result.user.isGrafanaAdmin == false"
+
+- name: Update Grafana user
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ name: "The Dark Knight"
+ email: thedarkknight@gotham.city
+ login: batman
+ password: robin
+ is_admin: true
+ state: present
+ register: result
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.user.name == 'The Dark Knight'"
+ - "result.user.email == 'thedarkknight@gotham.city'"
+ - "result.user.isGrafanaAdmin == true"
+
+- name: Delete a Grafana user
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ login: batman
+ state: absent
+ register: result
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.message == 'User deleted'"
+
+- name: Check idempotency on user deletion
+ grafana_user:
+ url: "{{ grafana_url }}"
+ url_username: "{{ grafana_username }}"
+ url_password: "{{ grafana_password }}"
+ login: batman
+ state: absent
+ register: result
+- assert:
+ that:
+ - "result.changed == false"
+ - "result.message == 'No user found, nothing to do'"