2 class postgres::backup_server {
3 include postgres::backup_server::globals
6 'libhash-merge-simple-perl',
11 'postgresql-client-9.6',
17 # Regularly pull base backups
19 concat { $postgres::backup_server::globals::base_backup_clusters:
20 ensure_newline => true,
22 Concat::Fragment <<| tag == $postgres::backup_server::globals::tag_base_backup |>>
24 file { '/usr/local/bin/postgres-make-base-backups':
26 content => template('postgres/backup_server/postgres-make-base-backups.erb'),
28 file { '/var/lib/dsa/postgres-make-base-backups':
33 concat::fragment { 'puppet-crontab--postgres-make_base_backups':
34 target => '/etc/cron.d/puppet-crontab',
36 */30 * * * * debbackup sleep $(( RANDOM \% 1200 )); chronic ${$postgres::backup_server::globals::make_base_backups}
41 # Maintain authorized_keys file on backup servers for WAL shipping
43 # do not let other hosts directly build our authorized_keys file,
44 # instead go via a script that somewhat validates intput
45 file { '/etc/dsa/postgresql-backup':
46 ensure => 'directory',
48 file { '/usr/local/bin/postgres-make-backup-sshauthkeys':
49 content => template('postgres/backup_server/postgres-make-backup-sshauthkeys.erb'),
51 notify => Exec['postgres-make-backup-sshauthkeys'],
53 file { '/usr/local/bin/postgres-make-one-base-backup':
54 source => 'puppet:///modules/postgres/backup_server/postgres-make-one-base-backup',
57 file { '/etc/dsa/postgresql-backup/sshkeys-manual':
58 content => template('postgres/backup_server/sshkeys-manual.erb'),
59 notify => Exec['postgres-make-backup-sshauthkeys'],
61 concat { $postgres::backup_server::globals::sshkeys_sources:
62 notify => Exec['postgres-make-backup-sshauthkeys'],
64 concat::fragment { 'postgresql-backup/source-sshkeys-header':
65 target => $postgres::backup_server::globals::sshkeys_sources ,
67 # <name> <ip addresses> <key>
71 Concat::Fragment <<| tag == $postgres::backup_server::globals::tag_source_sshkey |>>
72 exec { "postgres-make-backup-sshauthkeys":
73 command => "/usr/local/bin/postgres-make-backup-sshauthkeys",
78 # Maintain /etc/nagios/dsa-check-backuppg.conf
80 file { '/etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d':
81 ensure => 'directory',
85 source => 'puppet:///files/empty/',
86 notify => Exec['update dsa-check-backuppg-manual.conf'],
88 file { '/etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d/manual.conf':
89 content => template('postgres/backup_server/dsa-check-backuppg-manual.conf.erb'),
90 notify => Exec['update dsa-check-backuppg-manual.conf']
92 File<<| tag == $postgres::backup_server::globals::tag_dsa_check_backupp |>>
93 exec { "update dsa-check-backuppg-manual.conf":
95 perl -MYAML=LoadFile,Dump -MHash::Merge::Simple=merge -E 'say Dump(merge(map{LoadFile($_)}@ARGV))' /etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d/*.conf > /etc/nagios/dsa-check-backuppg.conf
102 # Maintain .pgpass file on backup servers
104 concat { $postgres::backup_server::globals::pgpassfile:
105 owner => 'debbackup',
106 group => 'debbackup',
109 concat::fragment{ 'pgpass-local':
110 target => $postgres::backup_server::globals::pgpassfile,
111 source => '/home/debbackup/.pgpass-local',
114 Concat::Fragment <<| tag == $postgres::backup_server::globals::tag_source_pgpassline |>>