Skip to content

Commit

Permalink
Set xpack config to enable authentication using username and password
Browse files Browse the repository at this point in the history
  • Loading branch information
milad-24 committed Sep 10, 2024
1 parent 543c582 commit 0e76aec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
$_tls_config = {}
}

if ($elasticsearch::password_enabled) {
$_xpack_password_config = {
'xpack.security.enabled' => true
}
}
else {
$_xpack_password_config = {}
}

# # Logging file or hash
# if ($elasticsearch::logging_file != undef) {
# $_log4j_content = undef
Expand All @@ -165,7 +174,7 @@

# Generate Elasticsearch config
$data =
$elasticsearch::config + { 'path.data' => $elasticsearch::datadir } + { 'path.logs' => $elasticsearch::logdir } + $_tls_config
$elasticsearch::config + { 'path.data' => $elasticsearch::datadir } + { 'path.logs' => $elasticsearch::logdir } + $_tls_config + $_xpack_password_config

file { "${elasticsearch::configdir}/elasticsearch.yml":
ensure => 'file',
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@
# @param version
# To set the specific version you want to install.
#
# @param password_enabled
# To enable or disable password authentication.
#
# @author Richard Pijnenburg <richard.pijnenburg@elasticsearch.com>
# @author Tyler Langlois <tyler.langlois@elastic.co>
# @author Gavin Williams <gavin.williams@elastic.co>
Expand Down Expand Up @@ -436,6 +439,7 @@
Boolean $restart_package_change = $restart_on_change,
Boolean $restart_plugin_change = $restart_on_change,
Stdlib::Filemode $logdir_mode = '2750',
Boolean $password_enabled = false
) {
#### Validate parameters

Expand Down

0 comments on commit 0e76aec

Please sign in to comment.