include "role::backup::postgresql"
+ ensure_packages(["python", "python-pip"])
+ package { "pylog2rotate":
+ source => "git+https://github.com/avian2/pylog2rotate",
+ ensure => present,
+ provider => "pip3",
+ require => Package["python-pip"],
+ }
+
ensure_packages(["rsync"])
ssh_keygen { $user:
description => "Backup the database",
},
{
- command => "/usr/bin/rm -f $(ls -1 $pg_backup_path/*.sql | sort -r | sed -e '1,16d')",
+ command => "/usr/bin/rm -f $(ls -1 $pg_backup_path/*.sql | grep -v 'T22:' | sort -r | sed -e '1,12d')",
user => $pg_user,
hour => 3,
minute => 0,
description => "Cleanup the database backups",
},
+ {
+ command => "cd $pg_backup_path ; /usr/bin/rm -f $(ls -1 *T22*.sql | log2rotate --skip 7 --fuzz 7 --delete --format='%Y-%m-%dT%H:%M:%S+02:00.sql')",
+ user => $pg_user,
+ hour => 3,
+ minute => 1,
+ description => "Cleanup the database backups exponentially",
+ },
]
}