Extend cleanup to weekly and monthly directories.
This commit is contained in:
20
odroid.yaml
20
odroid.yaml
@@ -101,7 +101,7 @@
|
||||
|
||||
- name: Find old daily backups
|
||||
find:
|
||||
paths: "{{ backup_dir }}/{{ item }}/daily/"
|
||||
paths: "{{ backup_dir }}/{{ item }}/daily"
|
||||
file_type: file
|
||||
age: 1h
|
||||
age_stamp: ctime
|
||||
@@ -125,9 +125,18 @@
|
||||
age: 1h
|
||||
age_stamp: ctime
|
||||
patterns: '*.sql.gz'
|
||||
recurse: false
|
||||
register: oldBackups
|
||||
loop: "{{ databases }}"
|
||||
|
||||
- name: Delete old weekly backups
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ oldBackups.results | map(attribute='files') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.path }}"
|
||||
|
||||
- name: Find old monthly backups
|
||||
find:
|
||||
paths: "{{ backup_dir }}/{{ item }}/monthly"
|
||||
@@ -135,5 +144,14 @@
|
||||
age: 13m
|
||||
age_stamp: ctime
|
||||
patterns: '*.sql.gz'
|
||||
recurse: false
|
||||
register: oldBackups
|
||||
loop: "{{ databases }}"
|
||||
|
||||
- name: Delete old monthly backups
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ oldBackups.results | map(attribute='files') | list }}"
|
||||
loop_control:
|
||||
label: "{{ item.path }}"
|
||||
|
||||
Reference in New Issue
Block a user