Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Provision alert notification channels using config file #227

Merged
merged 1 commit into from
Jul 26, 2020
Merged

Provision alert notification channels using config file #227

merged 1 commit into from
Jul 26, 2020

Conversation

hyzth
Copy link
Contributor

@hyzth hyzth commented Jul 22, 2020

Implement #143 (comment).

@github-actions github-actions bot added area/docs Improvements or additions to documentation area/tasks Logic behind ansible role area/tests Everything related to molecule tests and linters labels Jul 22, 2020
Comment on lines 2 to 26
- block:
- name: Check alert notifications list
uri:
url: "{{ grafana_api_url }}/api/alert-notifications"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
return_content: true
no_log: true
register: alert_notifications

- name: Create grafana alert notification channels
uri:
url: "{{ grafana_api_url }}/api/alert-notifications"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
method: POST
body_format: json
body: "{{ item | to_json }}"
with_items: "{{ grafana_alert_notifications }}"
no_log: true
when: ((alert_notifications['json'] | selectattr("name", "equalto", item['name'])) | list) | length == 0
- name: Create grafana alert notification channels
uri:
url: "{{ grafana_api_url }}/api/alert-notifications"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
method: POST
body_format: json
body: "{{ item | to_json }}"
with_items: "{{ grafana_alert_notifications }}"
no_log: true
when: ((alert_notifications['json'] | selectattr("name", "equalto", item['name'])) | list) | length == 0

when: not grafana_use_provisioning
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed. Idea is to remove all uri usage and move to grafana ansible modules. Adding this code moves us back and adds tech-debt.

After removing this, we need an information in README.md stating that grafana_alert_notifications can be used only when grafana_use_provisioning is enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed those two tasks and updated README. Could you please take another look?

@github-actions github-actions bot added the area/vars Ansible variables used in role label Jul 22, 2020
@paulfantom paulfantom merged commit 97aa210 into cloudalchemy:master Jul 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs Improvements or additions to documentation area/tasks Logic behind ansible role area/tests Everything related to molecule tests and linters area/vars Ansible variables used in role
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants