buxtehude is on postgresql 11
[mirror/dsa-puppet.git] / modules / postgres / manifests / backup_source.pp
1 #
2 # See dsa-wiki input/howto/postgres-backup.creole for some documentation
3 #
4 class postgres::backup_source {
5         file { "/usr/local/bin/pg-backup-file":
6                 mode    => '0555',
7                 source  => "puppet:///modules/roles/postgresql_server/pg-backup-file",
8         }
9         file { "/usr/local/bin/pg-receive-file-from-backup":
10                 mode    => '0555',
11                 source  => "puppet:///modules/roles/postgresql_server/pg-receive-file-from-backup",
12         }
13         file { "/etc/dsa/pg-backup-file.conf":
14                 content => template('roles/postgresql_server/pg-backup-file.conf.erb'),
15         }
16
17         if ! $::postgresql_key {
18                 exec { 'create-postgresql-key':
19                         command => '/bin/su - postgres -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'',
20                         onlyif  => '/usr/bin/getent passwd postgres > /dev/null && ! [ -e /var/lib/postgresql/.ssh/id_rsa ]'
21                 }
22         }
23
24
25         if $::hostname in [melartin, vittoria] {
26                 postgres::backup_cluster { $::hostname:
27                         pg_version => '9.6',
28                 }
29         }
30         if $::hostname in [buxtehude] {
31                 postgres::backup_cluster { $::hostname:
32                         pg_version => '11',
33                         pg_port => 5433,
34                 }
35                 postgres::backup_cluster { "${::hostname}-debbugs":
36                         pg_version => '11',
37                         pg_port => 5441,
38                         pg_cluster => 'debbugs',
39                 }
40         }
41         if $::hostname in [danzi] {
42                 postgres::backup_cluster { $::hostname:
43                         pg_version => '9.6',
44                         pg_port => 5433,
45                 }
46                 postgres::backup_cluster { "${::hostname}-debconf":
47                         pg_version => '9.6',
48                         pg_port => 5434,
49                         pg_cluster => 'debconf',
50                 }
51         }
52
53         if $::hostname in [melartin, vittoria, godard, buxtehude, danzi] {
54                 postgres::backup_server::register_backup_clienthost { "backup-clienthost-${::fqdn}}":
55                 }
56         }
57 }