community.grafana.grafana_user – Manage Grafana User

Note

This plugin is part of the community.grafana collection (version 1.3.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

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

The Grafana User is an admin.

Choices:

  • no ← (default)

  • yes

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

State if the user should be present in Grafana or not

Choices:

  • present ← (default)

  • absent

url

aliases: grafana_url

string / required

The Grafana URL.

url_password

aliases: grafana_password

string

The Grafana password for API authentication.

Default: “admin”

url_username

aliases: grafana_user

string

The Grafana user for API authentication.

Default: “admin”

use_proxy

boolean

If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • no

  • yes ← (default)

validate_certs

boolean

If no, SSL certificates will not be validated.

This should only set to no used on personally controlled sites using self-signed certificates.

Choices:

  • no

  • yes ← (default)

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

user

complex

Information about the User

Returned: when state present

email

string

The User email address

Returned: always

Sample: [“foo.bar@example.com”]

id

integer

The User id

Returned: always

Sample: [42]

isDisabled

boolean

The Grafana account status

Returned: always

Sample: [false]

isExternal

boolean

The Grafana account information on external user provider

Returned: always

Sample: [false]

isGrafanaAdmin

boolean

The Grafana user permission for admin

Returned: always

Sample: [false]

login

string

The User login

Returned: always

Sample: [“batman”]

orgId

integer

The organization id that the team is part of.

Returned: always

Sample: [1]

theme

string

The Grafana theme

Returned: always

Sample: [“light”]

Authors

  • Antoine Tanzilli (@Tailzip)

  • Hong Viet LE (@pomverte)

  • Julien Alexandre (@jual)

  • Marc Cyprien (@LeFameux)