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