diff --git a/docs/group_vars/dbms/dirvish_client.yml b/docs/group_vars/dbms/dirvish_client.yml index a91b04a..6964534 100644 --- a/docs/group_vars/dbms/dirvish_client.yml +++ b/docs/group_vars/dbms/dirvish_client.yml @@ -6,6 +6,15 @@ dirvish_client_snapshot_scripts: - mysql-snapshot.sh +# Advanced backup retention rule +dirvish_server_expire_rules: + # Keep first backup of the month for 6 months + - "* * 1 * * +6 months" + # Keep first backup of every quarter for 3 years + - "* * 1 1,4,7,10 * +3 years" + # Keep first backup of a year forever + - "* * 1 1 * never" + # Exclude the MariaDB data directory, as that's already covered by the snapshot dirvish_server_client_exclude: - 'var/lib/mysql/' diff --git a/galaxy.yml b/galaxy.yml index 668acae..438ebb7 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -7,7 +7,7 @@ namespace: s3lph name: dirvish # The version of the collection. Must be compatible with semantic versioning -version: 0.5.0 +version: 0.6.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/roles/dirvish_server/defaults/main.yml b/roles/dirvish_server/defaults/main.yml index 6f886e5..484e2f4 100644 --- a/roles/dirvish_server/defaults/main.yml +++ b/roles/dirvish_server/defaults/main.yml @@ -18,6 +18,7 @@ dirvish_server_image_name: "%Y%m%d-%H%M%S" dirvish_server_log_compression: gzip dirvish_server_index_compression: gzip dirvish_server_expire_default: "+31 days" +dirvish_server_expire_rules: [] dirvish_server_exclude: - lost+found/ diff --git a/roles/dirvish_server/templates/client_default.conf.j2 b/roles/dirvish_server/templates/client_default.conf.j2 index 92852b4..009f789 100644 --- a/roles/dirvish_server/templates/client_default.conf.j2 +++ b/roles/dirvish_server/templates/client_default.conf.j2 @@ -9,6 +9,12 @@ tree: / {% if item != inventory_hostname %} rsh: {{ hostvars[item].dirvish_server_client_rsh | default(dirvish_server_rsh) }} {% endif %} +{% if hostvars[item].dirvish_server_expire_rules is defined and hostvars[item].dirvish_server_expire_rules | length > 0 %} +expire-rule: +{% for rule in hostvars[item].dirvish_server_expire_rules %} + {{ rule }} +{% endfor %} +{% endif%} {% if hostvars[item].dirvish_server_client_exclude is defined and hostvars[item].dirvish_server_client_exclude | length > 0 %} exclude: