This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Provision alert notification channels using config file #227
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
paulfantom
suggested changes
Jul 22, 2020
tasks/notifications.yml
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement #143 (comment).