puppet-prod/modules/stalwart/manifests/storage.pp
Ben Vincent abb70983b1 feat: create stalwart module
- add stalwart module
- add psql database on the shared patroni instance
- add ceph-rgw credentials to eyaml
- ensure psql pass and s3 access key are converted to sensitive
2025-11-02 22:40:17 +11:00

35 lines
1.1 KiB
Puppet

# @summary Manages Stalwart Mail Server storage configuration
#
# @api private
class stalwart::storage {
assert_private()
# PostgreSQL connection configuration
$postgresql_config = {
'host' => $stalwart::postgresql_host,
'port' => $stalwart::postgresql_port,
'database' => $stalwart::postgresql_database,
'user' => $stalwart::postgresql_user,
'password' => $stalwart::postgresql_password.unwrap,
'ssl' => $stalwart::postgresql_ssl,
}
# S3/Ceph-RGW configuration
$s3_config = {
'endpoint' => $stalwart::s3_endpoint,
'bucket' => $stalwart::s3_bucket,
'region' => $stalwart::s3_region,
'access_key' => $stalwart::s3_access_key,
'secret_key' => $stalwart::s3_secret_key.unwrap,
'key_prefix' => $stalwart::s3_key_prefix,
}
# Validate storage configuration
if !$postgresql_config['host'] or !$postgresql_config['database'] {
fail('PostgreSQL host and database must be specified')
}
if !$s3_config['endpoint'] or !$s3_config['bucket'] {
fail('S3 endpoint and bucket must be specified')
}
}