W3cubDocs

/Ansible

community.grafana.grafana_folder – Manage Grafana Folders

Note

This plugin is part of the community.grafana collection (version 1.2.3).

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

To use it in a playbook, specify: community.grafana.grafana_folder.

New in version 1.0.0: of community.grafana

Synopsis

  • Create/update/delete Grafana Folders through the Folders API.

Requirements

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

  • The Folders API is only available starting Grafana 5 and the module will fail if the server version is lower than version 5.

Parameters

Parameter Choices/Defaults Comments
client_cert
path
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
path
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
string
The Grafana API key.
If set, url_username and url_password will be ignored.
name
string / required
The title of the Grafana Folder.

aliases: title
skip_version_check
boolean
added in 1.2.0 of community.grafana
    Choices:
  • no
  • yes
Skip Grafana version check and try to reach api endpoint anyway.
This parameter can be useful if you enabled `hide_version` in grafana.ini
state
string
    Choices:
  • present
  • absent
Delete the members not found in the members parameters from the
list of members found on the Folder.
url
string / required
The Grafana URL.

aliases: grafana_url
url_password
string
Default:
"admin"
The Grafana password for API authentication.

aliases: grafana_password
url_username
string
Default:
"admin"
The Grafana user for API authentication.

aliases: grafana_user
use_proxy
boolean
    Choices:
  • no
  • yes
If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
validate_certs
boolean
    Choices:
  • no
  • yes
If no, SSL certificates will not be validated.
This should only set to no used on personally controlled sites using self-signed certificates.

Examples

---
- name: Create a folder
  community.grafana.grafana_folder:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      title: "grafana_working_group"
      state: present

- name: Delete a folder
  community.grafana.grafana_folder:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      title: "grafana_working_group"
      state: absent

Return Values

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

Key Returned Description
folder
complex
On success
Information about the Folder

canAdmin
boolean
always
Boolean specifying if current user can admin in folder

Sample:
[False]
canEdit
boolean
always
Boolean specifying if current user can edit in folder

Sample:
[False]
canSave
boolean
always
Boolean specifying if current user can save in folder

Sample:
[False]
created
string
always
The folder creation date

Sample:
['2018-01-31T17:43:12+01:00']
createdBy
string
always
The name of the user who created the folder

Sample:
['admin']
hasAcl
boolean
always
Boolean specifying if folder has acl

Sample:
[False]
id
integer
always
The Folder identifier

Sample:
[42]
title
string
always
The Folder title

Sample:
['Department ABC']
uid
string
always
The Folder uid

Sample:
['nErXDvCkzz']
updated
string
always
The date the folder was last updated

Sample:
['2018-01-31T17:43:12+01:00']
updatedBy
string
always
The name of the user who last updated the folder

Sample:
['admin']
url
string
always
The Folder url

Sample:
['/dashboards/f/nErXDvCkzz/department-abc']
version
integer
always
The folder version

Sample:
[1]


Authors

  • Rémi REY (@rrey)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_folder_module.html