community.grafana.grafana_user – Manage Grafana User

Note

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

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 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.
email
string
The email of the Grafana User.
is_admin
boolean
    Choices:
  • no ←
  • yes
The Grafana User is an admin.
login
string / required
The login of the Grafana User.
name
string
The name of the Grafana User.
password
string
The password of the Grafana User.
At the moment, this field is not updated yet.
state
string
    Choices:
  • present ←
  • absent
State if the user should be present in Grafana or not
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 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 Returned Description
user
complex
when state present
Information about the User

 
email
string
always
The User email address

Sample:
 
id
integer
always
The User id

Sample:
[42]
 
isDisabled
boolean
always
The Grafana account status

Sample:
[False]
 
isExternal
boolean
always
The Grafana account information on external user provider

Sample:
[False]
 
isGrafanaAdmin
boolean
always
The Grafana user permission for admin

Sample:
[False]
 
login
string
always
The User login

Sample:
['batman']
 
orgId
integer
always
The organization id that the team is part of.

Sample:
[1]
 
theme
string
always
The Grafana theme

Sample:
['light']


Authors

  • Antoine Tanzilli (@Tailzip)

  • Hong Viet LE (@pomverte)

  • Julien Alexandre (@jual)

  • Marc Cyprien (@LeFameux)