salt.states.grafana4_user module

Manage Grafana v4.0 users

New in version 2017.7.0.

configuration:

This state requires a configuration profile to be configured in the minion config, minion pillar, or master config. The module will use the 'grafana' key by default, if defined.

Example configuration using basic authentication:

grafana:
  grafana_url: http://grafana.localhost
  grafana_user: admin
  grafana_password: admin
  grafana_timeout: 3

Example configuration using token based authentication:

grafana:
  grafana_url: http://grafana.localhost
  grafana_token: token
  grafana_timeout: 3
Ensure foobar user is present:
  grafana4_user.present:
    - name: foobar
    - password: mypass
    - email: "foobar@localhost"
    - fullname: Foo Bar
    - is_admin: true
salt.states.grafana4_user.absent(name, profile=u'grafana')

Ensure that a user is present.

name
Name of the user to remove.
profile
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
salt.states.grafana4_user.present(name, password, email=None, is_admin=False, fullname=None, theme=None, default_organization=None, organizations=None, profile=u'grafana')

Ensure that a user is present.

name
Name of the user.
password
Password of the user.
email
Optional - Email of the user.
is_admin
Optional - Set user as admin user. Default: False
fullname
Optional - Full name of the user.
theme
Optional - Selected theme of the user.
default_organization
Optional - Set user's default organization
organizations
Optional - List of viewer member organizations or pairs of organization and role that the user belongs to.
profile
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.

Here is an example for using default_organization and organizations parameters. The user will be added as a viewer to ReadonlyOrg, as an editor to TestOrg and as an admin to AdminOrg. When she logs on, TestOrg will be the default. The state will fail if any organisation is unknown or invalid roles are defined.

add_grafana_test_user:
  grafana4_user.present:
    - name: test
    - password: 1234567890
    - fullname: 'Test User'
    - default_organization: TestOrg
    - organizations:
      - ReadonlyOrg
      - TestOrg: Editor
      - Staging: Admin