X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fsalsa%2Fmanifests%2Fdatabase.pp;h=24647a3b1151046bfa41dfd6aa50b1f2d74be8c7;hb=7ca975698c14415282e911881890b3b7d8f8dc68;hp=de6d2db7ff3f130d9abedd3e5c352c1e70caff90;hpb=95efb9b2fbd478ed0f9ec8d2c28b9508c9006fa9;p=mirror%2Fdsa-puppet.git diff --git a/modules/salsa/manifests/database.pp b/modules/salsa/manifests/database.pp index de6d2db7f..24647a3b1 100644 --- a/modules/salsa/manifests/database.pp +++ b/modules/salsa/manifests/database.pp @@ -1,24 +1,50 @@ # class salsa::database inherits salsa { -# XXX does not work just yet. + class { 'postgresql::globals': + version => '9.6', + } + class { 'postgresql::server': + listen_addresses => '*', + } + class { 'postgresql::server::contrib': } -# include postgresql::server -# -# postgresql::server::db { $salsa::db_name: -# user => $salsa::db_role, -# password => postgresql_password($salsa::db_role, $salsa::db_password), -# } -# -# postgresql::server::extension { 'pg_trgm': -# database => $salsa::db_name, -# } + postgresql::server::db { $salsa::db_name: + user => $salsa::db_role, + password => postgresql_password($salsa::db_role, $salsa::db_password), + } -# so do things by hand for now - ensure_packages ( "postgresql", { ensure => 'installed' }) - # create role, create db owned by role, add extension + postgresql::server::extension { 'pg_trgm': + database => $salsa::db_name, + require => Class['postgresql::server::contrib'], + } - # XXX set up backups - file { "/var/lib/postgresql/9.6/main/.nobackup": - content => "" + $pg_config_options = { + 'track_counts' => 'yes', + 'archive_mode' => 'yes', + 'wal_level' => 'archive', + 'max_wal_senders' => '3', + 'archive_timeout' => '1h', + 'archive_command' => '/usr/local/bin/pg-backup-file main WAL %p', + 'ssl' => 'on', + 'ssl_cert_file' => '/etc/ssl/debian/certs/thishost-server.crt', + 'ssl_key_file' => '/etc/ssl/private/thishost-server.key', } + $pg_config_options.each |String $key, String $value| { + postgresql_conf { $key: + value => $value, + target => $postgresql::params::postgresql_conf_path, + notify => Service['postgresqld'], + } + } + + include postgres::backup_source + + postgres::backup_cluster { $::hostname: + pg_version => $postgresql::params::version, + pg_port => $postgresql::params::port, + do_role => true, + do_hba => true, + } + + include postgres::backup_server::register_backup_clienthost }