Code formatting for variable names and fix file age for cleaning daily backup .

This commit is contained in:
2021-11-19 12:20:29 +01:00
parent d208eb176b
commit be0167fd49

View File

@@ -139,18 +139,18 @@
find:
paths: "{{ backup_dir }}/{{ item }}/daily"
file_type: file
age: 1m
age: 8d
age_stamp: ctime
patterns: '*.gz'
recurse: false
register: oldBackups
register: backup_files
loop: "{{ systems }}"
- name: Delete old daily backups
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ oldBackups.results | map(attribute='files') | list }}"
with_items: "{{ backup_files.results | map(attribute='files') | list }}"
loop_control:
label: "{{ item.path }}"
@@ -162,14 +162,14 @@
age_stamp: ctime
patterns: '*.gz'
recurse: false
register: oldBackups
register: backup_files
loop: "{{ systems }}"
- name: Delete old weekly backups
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ oldBackups.results | map(attribute='files') | list }}"
with_items: "{{ backup_files.results | map(attribute='files') | list }}"
loop_control:
label: "{{ item.path }}"
@@ -181,14 +181,14 @@
age_stamp: ctime
patterns: '*.gz'
recurse: false
register: oldBackups
register: backup_files
loop: "{{ systems }}"
- name: Delete old monthly backups
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ oldBackups.results | map(attribute='files') | list }}"
with_items: "{{ backup_files.results | map(attribute='files') | list }}"
loop_control:
label: "{{ item.path }}"