Defined Type: elasticsearch::user

Defined in:
manifests/user.pp

Overview

Manages x-pack users.

Examples:

creates and manage a user with membership in the ‘logstash’ and ‘kibana4’ roles.

elasticsearch::user { 'bob':
  password => 'foobar',
  roles    => ['logstash', 'kibana4'],
}

Parameters:

  • ensure (Enum['absent', 'present']) (defaults to: 'present')

    Whether the user should be present or not. Set to ‘absent` to ensure a user is not installed

  • password (String)

    Password for the given user. A plaintext password will be managed with the esusers utility and requires a refresh to update, while a hashed password from the esusers utility will be managed manually in the uses file.

  • roles (Array) (defaults to: [])

    A list of roles to which the user should belong.

Author:

  • Tyler Langlois <tyler.langlois@elastic.co>

  • Gavin Williams <gavin.williams@elastic.co>



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'manifests/user.pp', line 25

define elasticsearch::user (
  String                    $password,
  Enum['absent', 'present'] $ensure = 'present',
  Array                     $roles  = [],
) {
  if $password =~ /^\$2a\$/ {
    elasticsearch_user_file { $name:
      ensure          => $ensure,
      configdir       => $elasticsearch::configdir,
      hashed_password => $password,
      before          => Elasticsearch_user_roles[$name],
    }
  } else {
    elasticsearch_user { $name:
      ensure    => $ensure,
      configdir => $elasticsearch::configdir,
      password  => $password,
      before    => Elasticsearch_user_roles[$name],
    }
  }

  elasticsearch_user_roles { $name:
    ensure => $ensure,
    roles  => $roles,
  }
}