+
+ # Maintain .pgpass file on backup servers
+ concat { $postgres::backup_server::globals::pgpassfile:
+ owner => 'debbackup',
+ group => 'debbackup',
+ mode => '0400'
+ }
+ concat::fragment{ 'pgpass-local':
+ target => $postgres::backup_server::globals::pgpassfile,
+ source => '/home/debbackup/.pgpass-local',
+ order => '00'
+ }
+ Concat::Fragment <<| tag == $postgres::backup_server::globals::tag_source_pgpassline |>>
+}
+
+define postgres::backup_server::register_backup_clienthost (
+ $sshpubkey = $::postgresql_key,
+ $ipaddrlist = join(getfromhash($site::nodeinfo, 'ldap', 'ipHostNumber'), ","),
+ $hostname = $::hostname,
+) {
+ include postgres::backup_server::globals
+
+ if $sshpubkey {
+ $addr = assert_type(String[1], $ipaddrlist)
+ @@concat::fragment { "postgresql::server::backup-source-clienthost::$name::$fqdn":
+ target => $postgres::backup_server::globals::sshkeys_sources ,
+ content => @("EOF"),
+ ${hostname} ${addr} ${sshpubkey}
+ | EOF
+ tag => $postgres::backup_server::globals::tag_source_sshkey,
+ }
+ }
+}
+
+define postgres::backup_server::register_backup_cluster (
+ $hostname = $::fqdn,
+ $pg_port,
+ $pg_role,
+ $pg_password,
+ $pg_cluster,
+ $pg_version,
+) {
+ include postgres::backup_server::globals
+
+ # foobar.debian.org:5432:*:debian-backup:swordfish
+ @@concat::fragment { "postgresql::server::backup-source-pgpassline::$hostname::$pg_port::$pg_role":
+ target => $postgres::backup_server::globals::pgpassfile,
+ content => @("EOF"),
+ ${hostname}:${pg_port}:*:${pg_role}:${pg_password}
+ | EOF
+ tag => $postgres::backup_server::globals::tag_source_pgpassline,
+ }
+ #
+ # vittoria.debian.org 5432 debian-backup main 9.6
+ @@concat::fragment { "postgresql::server::backup-source-make-base-backup-entry::$hostname::$pg_port::$pg_role":
+ target => $postgres::backup_server::globals::make_base_backups,
+ content => @("EOF"),
+ ${hostname} ${pg_port} ${pg_role} ${pg_cluster} ${pg_version}
+ | EOF
+ tag => $postgres::backup_server::globals::tag_base_backup,
+ }