grafana_dashboard – Manage Grafana dashboards¶
New in version 2.5.
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
client_cert
-
added in 2.7 |
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
|
|
client_key
-
added in 2.7 |
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
|
|
grafana_api_key
-
|
The Grafana API key.
If set, grafana_user and grafana_password will be ignored.
|
|
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
boolean
|
|
Override existing dashboard when state is present.
|
path
-
|
The path to the json file containing the Grafana dashboard to import or export.
|
|
slug
-
|
Deprecated since Grafana 5. Use grafana dashboard uid instead.
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.
|
uid
-
added in 2.7 |
uid of the dasboard to export when
state is export or absent . |
|
url
-
/ required
added in 2.7 |
The Grafana URL.
aliases: grafana_url |
|
url_password
-
added in 2.7 |
Default: "admin"
|
The Grafana API password.
aliases: grafana_password |
url_username
-
added in 2.7 |
Default: "admin"
|
The Grafana API user.
aliases: grafana_user |
use_proxy
boolean
added in 2.7 |
|
Boolean of whether or not to use proxy.
|
validate_certs
boolean
|
|
If
no , SSL certificates will not be validated.This should only be used on personally controlled sites using self-signed certificates.
|
Examples¶
- hosts: localhost
connection: local
tasks:
- name: Import Grafana dashboard foo
grafana_dashboard:
grafana_url: http://grafana.company.com
grafana_api_key: "{{ grafana_api_key }}"
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_user: "admin"
grafana_password: "{{ grafana_password }}"
org_id: 1
state: export
uid: "000000653"
path: "/path/to/dashboards/000000653.json"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
uid
string
|
success |
uid or slug of the created / deleted / exported dashboard.
Sample:
51
|
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Thierry Sallé (@seuf)
Hint
If you notice any issues in this documentation you can edit this document to improve it.