grafana_dashboard - Manage Grafana dashboards
New in version 2.5.
Synopsis
- Create, update, delete, export Grafana dashboards via API.
Parameters
| 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 belong to one organisation.. |
| overwrite |
| 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 |
| State of the dashboard. |
| validate_certs |
| If no, SSL certificates will not be validated.This should only be used on personally controlled sites using self-signed certificates. |
Examples
- 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
Return Values
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 |
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Author
- Thierry Sallé (@tsalle)
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/grafana_dashboard_module.html