Initial commit
This commit is contained in:
commit
9b77a54267
13
files/backup-strategy.sh
Executable file
13
files/backup-strategy.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Over 1 year, keep only 1 backup per 6 months
|
||||||
|
find -ctime +365 | grep -Ev -- '-0[16]-15\.' | xargs rm -fv
|
||||||
|
|
||||||
|
# Over 6 months, keep only 1 backup per month
|
||||||
|
find -ctime +183 | grep -v -- '-15.' | xargs rm -fv
|
||||||
|
|
||||||
|
# Over 1 month, keep only 2 backups per month
|
||||||
|
find -ctime +31 | grep -Ev -- '-(1|15)\.' | xargs rm -fv
|
||||||
|
|
||||||
|
# Over 1 week, keep only 1 backup per week
|
||||||
|
find -ctime +8 | grep -Ev -- '-(1|8|15|22|29)\.' | xargs rm -fv
|
24
meta/main.yml
Normal file
24
meta/main.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
role_name: backup-strategy
|
||||||
|
author: 'Pierre-Olivier Mercier <nemunaire+iac@nemunai.re>'
|
||||||
|
description: Install a script to be able to perform a cleaning between backups
|
||||||
|
license: GPL-3.0-or-later
|
||||||
|
min_ansible_version: 2.9
|
||||||
|
platforms:
|
||||||
|
- name: Alpine
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Gentoo
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
- name: Ubuntu
|
||||||
|
versions:
|
||||||
|
- all
|
||||||
|
galaxy_tags: []
|
5
tasks/main.yml
Normal file
5
tasks/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Copy the backup strategy script
|
||||||
|
copy:
|
||||||
|
src: backup_strategy.sh
|
||||||
|
dest: /media/backups/backup_strategy.sh
|
Loading…
Reference in New Issue
Block a user