Start moving vittoria over to puppetized pg backup
[mirror/dsa-puppet.git] / modules / postgres / manifests / backup_source.pp
1 #
2 class postgres::backup_source {
3         file { "/usr/local/bin/pg-backup-file":
4                 mode    => '0555',
5                 source  => "puppet:///modules/roles/postgresql_server/pg-backup-file",
6         }
7         file { "/usr/local/bin/pg-receive-file-from-backup":
8                 mode    => '0555',
9                 source  => "puppet:///modules/roles/postgresql_server/pg-receive-file-from-backup",
10         }
11         file { "/etc/dsa/pg-backup-file.conf":
12                 content => template('roles/postgresql_server/pg-backup-file.conf.erb'),
13         }
14
15         if ! $::postgresql_key {
16                 exec { 'create-postgresql-key':
17                         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\'',
18                         onlyif  => '/usr/bin/getent passwd postgres > /dev/null && ! [ -e /var/lib/postgresql/.ssh/id_rsa ]'
19                 }
20         }
21
22
23         if $::hostname in [melartin, vittoria] {
24                 postgres::backup_cluster { $::hostname:
25                         pg_version => '9.6',
26                 }
27         }
28
29         if $::hostname in [melartin, vittoria, godard] {
30                 postgres::backup_server::register_backup_clienthost { "backup-clienthost-${::fqdn}}":
31                 }
32         }
33 }