grafana.grafana.folder module – Manage Folders in Grafana

Note

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

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

New in version 0.0.1: of grafana.grafana

Synopsis

  • Create, Update and delete Folders via Ansible.

Requirements

The below requirements are needed on the host that executes this module.

  • requests >= 1.0.0

Parameters

Parameter

Comments

grafana_api_key

string / required

Grafana API Key to authenticate with Grafana.

overwrite

boolean

Set to false if you dont want to overwrite existing folder with newer version.

Choices:

  • no

  • yes ← (default)

stack_slug

string / required

Name of the Grafana Cloud stack to which the folder will be added

state

string

State for the Grafana CLoud stack.

Choices:

  • present ← (default)

  • absent

title

string / required

The title of the folder.

uid

string / required

unique identifier for your folder.

Examples

- name: Create/Update a Folder in Grafana
  grafana.grafana.folder:
    title: folder_name
    uid: folder_name
    overwrite: true
    stack_slug: "{{ stack_slug }}"
    grafana_api_key: "{{ grafana_api_key }}"
    state: present

- name: Delete a Folder in Grafana
  grafana.grafana.folder:
    uid: folder_name
    stack_slug: "{{ stack_slug }}"
    grafana_api_key: "{{ grafana_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

canAdmin

boolean

Boolean value specifying if current user can admin in folder

Returned: state is present and on success

canDelete

boolean

Boolean value specifying if current user can delete the folder

Returned: state is present and on success

canEdit

boolean

Boolean value specifying if current user can edit in folder

Returned: state is present and on success

canSave

boolean

Boolean value specifying if current user can save in folder

Returned: state is present and on success

created

string

The date when folder was created

Returned: state is present and on success

createdBy

string

The name of the user who created the folder

Returned: state is present and on success

hasAcl

boolean

Boolean value specifying if folder has acl

Returned: state is present and on success

id

integer

The ID for the folder

Returned: on success

message

string

The message returned after the operation on the folder

Returned: state is absent and on success

title

string

The name of the folder

Returned: on success

uid

string

The UID for the folder

Returned: state is present and on success

updated

string

The date when the folder was last updated

Returned: state is present and on success

updatedBy

string

The name of the user who last updated the folder

Returned: state is present and on success

url

string

The URl for the folder

Returned: state is present and on success

version

integer

The version of the folder

Returned: state is present and on success

Authors

  • Ishan Jain (@ishanjainn)