community.grafana.grafana_user (1.8.0) — module

Manage Grafana User

| "added in version" 1.0.0 of community.grafana"

Authors: Antoine Tanzilli (@Tailzip), Hong Viet LE (@pomverte), Julien Alexandre (@jual), Marc Cyprien (@LeFameux)

Install collection

Install with ansible-galaxy collection install community.grafana:==1.8.0


Add to requirements.yml

  collections:
    - name: community.grafana
      version: 1.8.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- 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: batman@gotham.city
    login: batman
    password: robin
    is_admin: true
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a Grafana user
  community.grafana.grafana_user:
    url: "https://grafana.example.com"
    url_username: admin
    url_password: changeme
    login: batman
    state: absent

Inputs

    
url:
    aliases:
    - grafana_url
    description:
    - The Grafana URL.
    required: true
    type: str

name:
    description:
    - The name of the Grafana User.
    required: false
    type: str

email:
    description:
    - The email of the Grafana User.
    required: false
    type: str

login:
    description:
    - The login of the Grafana User.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State if the user should be present in Grafana or not
    type: str

is_admin:
    default: false
    description:
    - The Grafana User is an admin.
    required: false
    type: bool

password:
    description:
    - The password of the Grafana User.
    - At the moment, this field is not updated yet.
    required: false
    type: str

use_proxy:
    default: true
    description:
    - If C(false), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

client_key:
    description:
    - PEM formatted file that contains your private key to be used for SSL client authentication.
    - If I(client_cert) contains both the certificate and key, this option is not required.
    type: path

client_cert:
    description:
    - 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, I(client_key)
      is not required
    type: path

url_password:
    aliases:
    - grafana_password
    default: admin
    description:
    - The Grafana password for API authentication.
    type: str

url_username:
    aliases:
    - grafana_user
    default: admin
    description:
    - The Grafana user for API authentication.
    type: str

validate_certs:
    default: true
    description:
    - If C(false), SSL certificates will not be validated.
    - This should only set to C(false) used on personally controlled sites using self-signed
      certificates.
    type: bool

Outputs

user:
  contains:
    email:
      description: The User email address
      returned: always
      sample:
      - foo.bar@example.com
      type: str
    id:
      description: The User id
      returned: always
      sample:
      - 42
      type: int
    isDisabled:
      description: The Grafana account status
      returned: always
      sample:
      - false
      type: bool
    isExternal:
      description: The Grafana account information on external user provider
      returned: always
      sample:
      - false
      type: bool
    isGrafanaAdmin:
      description: The Grafana user permission for admin
      returned: always
      sample:
      - false
      type: bool
    login:
      description: The User login
      returned: always
      sample:
      - batman
      type: str
    orgId:
      description: The organization id that the team is part of.
      returned: always
      sample:
      - 1
      type: int
    theme:
      description: The Grafana theme
      returned: always
      sample:
      - light
      type: str
  description: Information about the User
  returned: when state present
  type: complex