grafana.grafana.dashboard module – Manage Dashboards in Grafana

Note

This module is part of the grafana.grafana collection (version 0.0.6).

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 grafana.grafana.

To use it in a playbook, specify: grafana.grafana.dashboard.

New in version 0.0.1: of grafana.grafana

Synopsis

  • Create, Update and delete Dashboards using Ansible.

Parameters

Parameter

Comments

cloud_api_key

string / required

CLoud API Key to authenticate with Grafana Cloud.

dashboard

dictionary / required

JSON source code for dashboard

stack_slug

string / required

Name of the Grafana Cloud stack to which the notification policies will be added

state

string

State for the Grafana CLoud stack.

Choices:

  • present ← (default)

  • absent

Examples

- name: Create/Update a dashboard
  dashboard:
    datasource: "{{ lookup('file', 'dashboard.json') }}"
    stack_slug: "{{ stack_slug }}"
    cloud_api_key: "{{ grafana_cloud_api_key }}"
    state: present

- name: Delete dashboard
  dashboard:
    datasource: "{{ lookup('file', 'dashboard.json') }}"
    stack_slug: "{{ stack_slug }}"
    cloud_api_key: "{{ grafana_cloud_api_key }}"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

output

dictionary

Dict object containing folder information

Returned: On success

id

integer

The ID for the dashboard

Returned: on success

message

string

The message returned after the operation on the dashboard

Returned: state is absent and on success

slug

string

The slug for the dashboard

Returned: state is present and on success

status

string

The status of the dashboard

Returned: state is present and on success

title

string

The name of the dashboard

Returned: state is absent and on success

uid

string

The UID for the dashboard

Returned: state is present and on success

url

string

The endpoint for the dashboard

Returned: state is present and on success

version

integer

The version of the dashboard

Returned: state is present and on success

Authors

  • Ishan Jain (@ishanjainn)