Skip to content

Commit

Permalink
Add initial_admin_password parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymind1337 committed Feb 26, 2024
1 parent acabb95 commit ec1ab31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# Whether to enable the `apt::pin` or `yum::versionlock` for the package.
# @param apt_pin_priority
# The priority for apt::pin of the opensearch package.
# @param initial_admin_password
# Password for intial installation of the package.
#
# @param manage_config
# Whether to manage the configuration.
Expand Down Expand Up @@ -116,6 +118,7 @@
Enum['x64', 'arm64'] $package_architecture,
Enum['dpkg', 'rpm'] $package_provider,
Hash $default_settings,
String[1] $initial_admin_password,

##
## version
Expand Down
5 changes: 5 additions & 0 deletions manifests/install/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@
}
}

exec { 'set_initial_password_environment':
command => "export OPENSEARCH_INITIAL_ADMIN_PASSWORD=${opensearch::initial_admin_password}"
}

package { 'opensearch':
ensure => $ensure,
provider => $provider,
source => $source,
require => Exec['set_initial_password_environment'],
}
}
13 changes: 9 additions & 4 deletions spec/acceptance/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
context 'default parameter' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
'include opensearch'
<<~PP
class { 'opensearch':
initial_admin_password => 'some_random_password',
}
PP
end
end

Expand Down Expand Up @@ -49,9 +53,10 @@
let(:manifest) do
<<~PP
class { 'opensearch':
version => '2.9.0',
package_source => 'archive',
settings => {
version => '2.9.0',
package_source => 'archive',
initial_admin_password => 'some_random_password',
settings => {
# When installing from an archive, the demo certificates are not
# installed by default.
'plugins.security.disabled' => true,
Expand Down

0 comments on commit ec1ab31

Please sign in to comment.