Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding ansible role for silences #358

Merged
merged 10 commits into from
May 2, 2024
Merged
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Click on the name of a plugin or module to view that content's documentation:
- [grafana_plugin](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_plugin_module.html)
- [grafana_team](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_team_module.html)
- [grafana_user](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_user_module.html)
- [grafana_silence](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_silence_module.html)

## Supported Grafana versions

Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/add grafana_silence role.yml
Nemental marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- grafana_silence ; adding new role to create and delete silences through the API
Nemental marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions roles/grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ Configure Grafana organizations, dashboards, folders, datasources, teams and use
| webhook_password | no |
| webhook_url | no |
| webhook_username | no |
| [**grafana_silence**](https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_silence_module.html) |
| comment | yes |
| created_by | yes |
| starts_at | yes |
| ends_at | yes |
| state | no |
Nemental marked this conversation as resolved.
Show resolved Hide resolved

## Example Playbook

Expand Down
1 change: 1 addition & 0 deletions roles/grafana/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ grafana_datasources: []
grafana_folders: []
grafana_dashboards: []
grafana_notification_channels: []
grafana_silences: []
2 changes: 1 addition & 1 deletion roles/grafana/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
galaxy_info:
role_name: grafana
author: community
description: Configure Grafana organizations, dashboards, folders, datasources, teams and users
description: Configure Grafana organizations, dashboards, folders, datasources, silences, teams and users
license: GPLv3
min_ansible_version: "2.14"
galaxy_tags: [grafana, monitoring]
Expand Down
12 changes: 12 additions & 0 deletions roles/grafana/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,15 @@
loop: "{{ grafana_dashboards }}"
loop_control: {loop_var: dashboard}
tags: [dashboard, molecule-idempotence-notest]

- name: Manage silence
community.grafana.grafana_silence:
comment: "{{ silence.comment }}"
created_by: "{{ silence.created_by }}"
starts_at: "{{ silence.starts_at }}"
ends_at: "{{ silence.ends_at }}"
matchers: "{{ silence.matchers }}"
state: "{{ silence.state | default(omit) }}"
loop: "{{ grafana_silences }}"
loop_control: {loop_var: silence}
tags: silence
Loading