X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fsalsa%2Fmanifests%2Fdatabase.pp;h=b363b7928c80e7177c340533d6d504be18afb11b;hb=872979e8aae8f604651cbc9fb2c07c5c22245714;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..b363b7928 100644 --- a/modules/salsa/manifests/database.pp +++ b/modules/salsa/manifests/database.pp @@ -1,24 +1,38 @@ # 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": + include postgres::backup_source + $datadir = assert_type(String[1], $postgresql::params::datadir) + warning("foo ") + file { "${datadir}/.nobackup": content => "" } + if $::postgresql_key { + $ipaddr = assert_type(String[1], join(getfromhash($site::nodeinfo, 'ldap', 'ipHostNumber'), ",")) + + @@concat::fragment { "onion::balance::instance::dsa-snippet::$name::$fqdn": + target => "/etc/dsa/postgresql-backup/sshkeys-sources", + content => @("EOF"), + ${::hostname} ${ipaddr} ${::postgresql_key} + | EOF + tag => "postgresql::server::backup-source-sshkey", + } + } }