diff --git a/manifests/role.pp b/manifests/role.pp index f9a458b..d2fe507 100644 --- a/manifests/role.pp +++ b/manifests/role.pp @@ -1,60 +1,58 @@ -# Manage shield/x-pack roles. +# Manage x-pack roles. # # @param ensure # Whether the role should be present or not. # Set to 'absent' to ensure a role is not present. # # @param mappings # A list of optional mappings defined for this role. # # @param privileges # A hash of permissions defined for the role. Valid privilege settings can -# be found in the Shield/x-pack documentation. +# be found in the x-pack documentation. # # @example create and manage the role 'power_user' mapped to an LDAP group. # elasticsearch::role { 'power_user': # privileges => { # 'cluster' => 'monitor', # 'indices' => { # '*' => 'all', # }, # }, # mappings => [ # "cn=users,dc=example,dc=com", # ], # } # # @author Tyler Langlois +# @author Gavin Williams # define elasticsearch::role ( Enum['absent', 'present'] $ensure = 'present', Array $mappings = [], Hash $privileges = {}, ) { validate_slength($name, 30, 1) - if $elasticsearch::security_plugin == undef { - fail("\"${elasticsearch::security_plugin}\" required") - } if empty($privileges) or $ensure == 'absent' { $_role_ensure = 'absent' } else { $_role_ensure = $ensure } if empty($mappings) or $ensure == 'absent' { $_mapping_ensure = 'absent' } else { $_mapping_ensure = $ensure } elasticsearch_role { $name : ensure => $_role_ensure, privileges => $privileges, } elasticsearch_role_mapping { $name : ensure => $_mapping_ensure, mappings => $mappings, } } diff --git a/manifests/user.pp b/manifests/user.pp index e22a16a..b970836 100644 --- a/manifests/user.pp +++ b/manifests/user.pp @@ -1,51 +1,48 @@ -# Manages shield/x-pack users. +# Manages x-pack users. # # @example creates and manage a user with membership in the 'logstash' and 'kibana4' roles. # elasticsearch::user { 'bob': # password => 'foobar', # roles => ['logstash', 'kibana4'], # } # # @param ensure # Whether the user should be present or not. # Set to `absent` to ensure a user is not installed # # @param password # 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. # # @param roles # A list of roles to which the user should belong. # # @author Tyler Langlois +# @author Gavin Williams # define elasticsearch::user ( String $password, Enum['absent', 'present'] $ensure = 'present', Array $roles = [], ) { - if $elasticsearch::security_plugin == undef { - fail("\"${elasticsearch::security_plugin}\" required") - } - if $password =~ /^\$2a\$/ { elasticsearch_user_file { $name: ensure => $ensure, configdir => $elasticsearch::configdir, hashed_password => $password, } } else { elasticsearch_user { $name: ensure => $ensure, configdir => $elasticsearch::configdir, password => $password, } } elasticsearch_user_roles { $name: ensure => $ensure, roles => $roles, } }