- Docs »
- grafana_dashboard - Manage Grafana dashboards
-
You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
grafana_dashboard - Manage Grafana dashboards
- Create, update, delete, export Grafana dashboards via API.
Parameter |
Choices/Defaults |
Comments |
grafana_api_key
|
|
The Grafana API key.
If set, grafana_user and grafana_password will be ignored.
|
grafana_password
|
Default:
"admin"
|
The Grafana API password.
|
grafana_url
required |
|
The Grafana URL.
|
grafana_user
|
Default:
"admin"
|
The Grafana API user.
|
message
|
|
Set a commit message for the version history.
Only used when state is present .
|
org_id
|
Default:
1
|
The Grafana Organisation ID where the dashboard will be imported / exported.
Not used when grafana_api_key is set, because the grafana_api_key only belongs to one organisation..
|
overwrite
bool |
|
Override existing dashboard when state is present.
|
path
|
|
The path to the json file containing the Grafana dashboard to import or export.
|
slug
|
|
slug of the dashboard. It's the friendly url name of the dashboard.
When state is present , this parameter can override the slug in the meta section of the json file.
If you want to import a json dashboard exported directly from the interface (not from the api), you have to specify the slug parameter because there is no meta section in the exported json.
|
state
required |
Choices:
- absent
- export
present ←
|
State of the dashboard.
|
validate_certs
bool |
|
If no , SSL certificates will not be validated.
This should only be used on personally controlled sites using self-signed certificates.
|
- name: Import Grafana dashboard foo
grafana_dashboard:
grafana_url: http://grafana.company.com
grafana_api_key: XXXXXXXXXXXX
state: present
message: Updated by ansible
overwrite: yes
path: /path/to/dashboards/foo.json
- name: Export dashboard
grafana_dashboard:
grafana_url: http://grafana.company.com
grafana_api_key: XXXXXXXXXXXX
state: export
slug: foo
path: /path/to/dashboards/foo.json
Common return values are documented here, the following are the fields unique to this module:
Key |
Returned |
Description |
slug
string
|
success |
slug of the created / deleted / exported dashboard.
Sample:
foo
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.