community.grafana.grafana_user module – Manage Grafana User
Note
This module is part of the community.grafana collection (version 1.5.0).
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_user
.
New in version 1.0.0: of community.grafana
Synopsis
Create/update/delete Grafana User through the users and admin API.
Tested with Grafana v6.4.3
Password update is not supported at the time
Parameters
Parameter |
Comments |
---|---|
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 |
|
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. |
|
The email of the Grafana User. |
|
The Grafana User is an admin. Choices:
|
|
The login of the Grafana User. |
|
The name of the Grafana User. |
|
The password of the Grafana User. At the moment, this field is not updated yet. |
|
State if the user should be present in Grafana or not Choices:
|
|
The Grafana URL. |
|
The Grafana password for API authentication. Default: “admin” |
|
The Grafana user for API authentication. Default: “admin” |
|
If Choices:
|
|
If This should only set to Choices:
|
Notes
Note
Unlike other modules from the collection, this module does not support grafana_api_key authentication type. The Grafana API endpoint for users management requires basic auth and admin privileges.
Examples
---
- name: Create or update a Grafana user
community.grafana.grafana_user:
url: "https://grafana.example.com"
url_username: admin
url_password: changeme
name: "Bruce Wayne"
email: [email protected]
login: batman
password: robin
is_admin: true
state: present
- name: Delete a Grafana user
community.grafana.grafana_user:
url: "https://grafana.example.com"
url_username: admin
url_password: changeme
login: batman
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information about the User Returned: when state present |
|
The User id Returned: always Sample: [42] |
|
The Grafana account status Returned: always Sample: [false] |
|
The Grafana account information on external user provider Returned: always Sample: [false] |
|
The Grafana user permission for admin Returned: always Sample: [false] |
|
The User login Returned: always Sample: [“batman”] |
|
The organization id that the team is part of. Returned: always Sample: [1] |
|
The Grafana theme Returned: always Sample: [“light”] |
Authors
Antoine Tanzilli (@Tailzip)
Hong Viet LE (@pomverte)
Julien Alexandre (@jual)
Marc Cyprien (@LeFameux)