Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/swh/deploy/indexer_journal_client.pp
Show All 18 Lines | case $ensure { | ||||
'present', 'running': { | 'present', 'running': { | ||||
$config = lookup("swh::deploy::indexer_journal_client::${instance_name}::config") | $config = lookup("swh::deploy::indexer_journal_client::${instance_name}::config") | ||||
$loglevel = lookup("swh::deploy::indexer_journal_client::${instance_name}::loglevel") | $loglevel = lookup("swh::deploy::indexer_journal_client::${instance_name}::loglevel") | ||||
$sentry_dsn = lookup("swh::deploy::indexer::sentry_dsn", Optional[String], "first", undef) | $sentry_dsn = lookup("swh::deploy::indexer::sentry_dsn", Optional[String], "first", undef) | ||||
$sentry_environment = lookup("swh::deploy::indexer::sentry_environment", Optional[String], "first", undef) | $sentry_environment = lookup("swh::deploy::indexer::sentry_environment", Optional[String], "first", undef) | ||||
$sentry_swh_package = lookup("swh::deploy::indexer::sentry_swh_package", Optional[String], "first", undef) | $sentry_swh_package = lookup("swh::deploy::indexer::sentry_swh_package", Optional[String], "first", undef) | ||||
# Optional authentication | |||||
$journal_authentication = lookup("swh::deploy::indexer_journal_client::${instance_name}::journal_authentication") | |||||
if $journal_authentication { | |||||
$username = lookup('swh::deploy::indexer_journal_client::journal::username') | |||||
$password = lookup('swh::deploy::indexer_journal_client::journal::password') | |||||
# Integrate authentication configuration entries into the $config dict | |||||
$suffix_group_id = $config["journal"]["group_id"] | |||||
# Subtility about ACL which requires the group id to be prefixed by the username | |||||
$group_id = "${username}-${suffix_group_id}" | |||||
$full_config = deep_merge($config, { | |||||
"journal" => { | |||||
"group_id" => $group_id, | |||||
"sasl.mechanism" => "SCRAM-SHA-512", | |||||
"security.protocol" => "SASL_SSL", | |||||
"sasl.username" => $username, | |||||
"sasl.password" => $password, | |||||
}, | |||||
}) | |||||
} else { | |||||
$full_config = $config | |||||
} | |||||
file {$config_path: | file {$config_path: | ||||
ensure => present, | ensure => present, | ||||
owner => "root", | owner => "root", | ||||
group => $::profile::swh::deploy::base_indexer::group, | group => $::profile::swh::deploy::base_indexer::group, | ||||
mode => "0640", | mode => "0640", | ||||
content => inline_yaml($config), | content => inline_yaml($full_config), | ||||
notify => Service[$service_name], | notify => Service[$service_name], | ||||
require => File[$config_directory], | require => File[$config_directory], | ||||
} | } | ||||
$nb_instances = lookup("swh::deploy::indexer_journal_client::${instance_name}::nb_instances", { | $nb_instances = lookup("swh::deploy::indexer_journal_client::${instance_name}::nb_instances", { | ||||
default_value => 1, | default_value => 1, | ||||
value_type => Integer | value_type => Integer | ||||
}) | }) | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |