New in version 2.5.
Parameter |
Choices/Defaults |
Comments |
---|---|---|
grafana_api_key
|
|
Grafana API key
If set, grafana_user and grafana_password will be ignored
|
grafana_password
|
Default:
admin
|
Grafana API password
|
grafana_url
required |
|
Grafana url
|
grafana_user
|
Default:
admin
|
Grafana API user
|
message
|
|
Set a commit message for the version history.
Only used when state is present
|
org_id
|
Default:
yes
|
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
|
Default:
no
|
override existing dashboard when state is present.
|
path
|
|
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 usedon 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: true
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.
Hint
If you notice any issues in this documentation you can edit this document to improve it.