Join AnsibleFest at Red Hat Summit!

grafana.grafana.user module – Manage Users in Grafana

Note

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

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. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: grafana.grafana.user.

New in grafana.grafana 0.0.1

Synopsis

  • Create, Update and delete Users using Ansible.

Requirements

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

  • requests >= 1.0.0

Parameters

Parameter

Comments

admin_name

string / required

Grafana admin username

admin_password

string / required

Grafana admin password

email

string

Email address of the user.

grafana_url

string / required

URL of the Grafana instance.

login

string / required

Login of the user

name

string

Name of the user.

password

string

Password of the user. Should be provided if state=present

state

string

State for the Grafana User.

Choices:

  • "present" ← (default)

  • "absent"

Notes

Note

  • Does not support check_mode.

  • Does not support Idempotency.

Examples

- name: Create/Update a user
  grafana.grafana.user:
    login: "grafana_user"
    password: "{{ lookup('ansible.builtin.password') }}"
    email: "grafana_user@localhost.local
    name: "grafana user"
    grafana_url: "{{ grafana_url }}"
    admin_name: "admin"
    admin_password: "admin"
    state: present

- name: Delete user
  grafana.grafana.user:
    login: "grafana_user"
    grafana_url: "{{ grafana_url }}"
    admin_name: "admin"
    admin_password: "admin"
    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 user information and message.

Returned: On success

email

string

The email for the user.

Returned: on success

Sample: "grafana_user@localhost.local"

id

integer

The ID for the user.

Returned: on success

Sample: 17

login

string

The login for the user.

Returned: on success

Sample: "grafana_user"

name

string

The name for the user.

Returned: on success

Sample: "grafana user"

Authors

  • Mathieu Valois, téïcée