-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow alert resource provisioning (#110)
- Loading branch information
Showing
3 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,9 @@ grafana_alert_notifications: [] | |
# settings: | ||
# addresses: "[email protected]" | ||
|
||
# Alert resources channels to configure | ||
grafana_alert_resources: {} | ||
|
||
# Datasources to configure | ||
grafana_datasources: [] | ||
# - name: "Prometheus" | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
--- | ||
# legacy config | ||
- name: "Create/Delete/Update alert notifications channels (provisioning)" | ||
ansible.builtin.copy: | ||
content: | | ||
apiVersion: 1 | ||
{{ grafana_alert_notifications | to_nice_yaml }} | ||
dest: /etc/grafana/provisioning/notifiers/ansible.yml | ||
dest: /etc/grafana/provisioning/notification/ansible.yml | ||
owner: root | ||
group: grafana | ||
mode: 0640 | ||
become: true | ||
notify: restart_grafana | ||
when: grafana_use_provisioning | ||
when: grafana_use_provisioning and grafana_alert_notifications | length > 0 | ||
|
||
# new alert resources | ||
- name: "Create/Delete/Update alert resources (provisioning)" | ||
ansible.builtin.copy: | ||
content: | | ||
apiVersion: 1 | ||
{{ grafana_alert_resources | to_nice_yaml }} | ||
dest: /etc/grafana/provisioning/alerting/ansible.yml | ||
owner: root | ||
group: grafana | ||
mode: 0640 | ||
become: true | ||
notify: restart_grafana | ||
when: grafana_use_provisioning and grafana_alert_resources | length > 0 |