community.grafana.grafana_silence module – Manage Grafana Silences
Note
This module is part of the community.grafana collection (version 2.1.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.grafana
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.grafana.grafana_silence
.
New in community.grafana 1.9.0
Synopsis
Create/delete Grafana Silences through the Alertmanager Silence API.
Requirements
The below requirements are needed on the host that executes this module.
The Alertmanager API is only available starting Grafana 8 and the module will fail if the server version is lower than version 8.
Parameters
Parameter |
Comments |
---|---|
PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, client_key is not required |
|
PEM formatted file that contains your private key to be used for SSL client authentication. If client_cert contains both the certificate and key, this option is not required. |
|
The comment that describes the silence. |
|
The author that creates the silence. |
|
ISO 8601 Timestamp with milliseconds e.g. “2029-07-29T08:45:45.000Z” when the silence will end. |
|
The Grafana API key. If set, |
|
List of matchers to select which alerts are affected by the silence. |
|
The Grafana organization ID where the silence will be created or deleted. Not used when grafana_api_key is set, because the grafana_api_key only belongs to one organization. Mutually exclusive with Default: |
|
The Grafana organization name where the silence will be created or deleted. Not used when grafana_api_key is set, because the grafana_api_key only belongs to one organization. Mutually exclusive with |
|
Skip Grafana version check and try to reach api endpoint anyway. This parameter can be useful if you enabled `hide_version` in grafana.ini Choices:
|
|
ISO 8601 Timestamp with milliseconds e.g. “2029-07-29T08:45:45.000Z” when the silence starts. |
|
Delete the first occurrence of a silence with the same settings. Can be “absent” or “present”. Choices:
|
|
The Grafana URL. |
|
The Grafana password for API authentication. Default: |
|
The Grafana user for API authentication. Default: |
|
If Choices:
|
|
If This should only set to Choices:
|
Examples
---
- name: Create a silence
community.grafana.grafana_silence:
grafana_url: "https://grafana.example.com"
grafana_api_key: "{{ some_api_token_value }}"
comment: "a testcomment"
created_by: "me"
starts_at: "2029-07-29T08:45:45.000Z"
ends_at: "2029-07-29T08:55:45.000Z"
matchers:
- isEqual: true
isRegex: true
name: environment
value: test
state: present
- name: Delete a silence
community.grafana.grafana_silence:
grafana_url: "https://grafana.example.com"
grafana_api_key: "{{ some_api_token_value }}"
comment: "a testcomment"
created_by: "me"
starts_at: "2029-07-29T08:45:45.000Z"
ends_at: "2029-07-29T08:55:45.000Z"
matchers:
- isEqual: true
isRegex: true
name: environment
value: test
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information about the silence Returned: On success |
|
The comment of the silence Returned: success Sample: |
|
The author of the silence Returned: success Sample: |
|
The end timestamp of the silence Returned: success Sample: |
|
The id of the silence Returned: success Sample: |
|
The matchers of the silence Returned: success Sample: |
|
The begin timestamp of the silence Returned: success Sample: |
|
The status of the silence Returned: success Sample: |
|
The timestamp of the last update for the silence Returned: success Sample: |