grafana-ansible-collection/tests/integration/targets/alert_contact_point/tasks/main.yml

73 lines
1.9 KiB
YAML
Raw Normal View History

2023-03-03 09:53:02 +01:00
---
- name: Create Alerting contact point
grafana.grafana.alert_contact_point:
name: ops-email
uid: opsemail
type: email
2023-03-03 09:53:02 +01:00
settings:
addresses: ops@mydomain.com,devs@mydomain.com
stack_slug: "{{ stack_name }}"
grafana_api_key: "{{ grafana_api_key }}"
state: present
register: add_result
2023-03-03 09:53:02 +01:00
- name: Add Check
ansible.builtin.assert:
that:
- add_result.failed == false
- add_result.output.provenance == "api"
- name: Idempotency Check
grafana.grafana.alert_contact_point:
name: ops-email
uid: opsemail
type: email
2023-03-03 09:53:02 +01:00
settings:
addresses: ops@mydomain.com,devs@mydomain.com
stack_slug: "{{ stack_name }}"
grafana_api_key: "{{ grafana_api_key }}"
state: present
register: idempotent_result
2023-03-03 09:53:02 +01:00
- name: Changed Check
ansible.builtin.assert:
that:
- idempotent_result.changed == false
- idempotent_result.output.provenance == "api"
- name: Update Alerting contact point
grafana.grafana.alert_contact_point:
name: ops-email
uid: opsemail
type: email
2023-03-03 09:53:02 +01:00
settings:
addresses: "ops@mydomain.com,devs@mydomain.com,admin@mydomain.com"
stack_slug: "{{ stack_name }}"
grafana_api_key: "{{ grafana_api_key }}"
state: present
register: update_result
2023-03-03 09:53:02 +01:00
- name: Failed Check
ansible.builtin.assert:
that:
- update_result.failed == false
- update_result.output.provenance == "api"
- name: Delete Alerting contact point
grafana.grafana.alert_contact_point:
name: ops-email
uid: opsemail
type: email
2023-03-03 09:53:02 +01:00
settings:
addresses: "ops@mydomain.com,devs@mydomain.com,admin@mydomain.com"
stack_slug: "{{ stack_name }}"
grafana_api_key: "{{ grafana_api_key }}"
state: absent
register: delete_result
2023-03-03 09:53:02 +01:00
- name: Delete Check
ansible.builtin.assert:
that:
- delete_result.failed == false
2023-03-03 09:53:02 +01:00
- delete_result.output.message == "contactpoint deleted"