Find old backup files for semaphore playbook.
This commit is contained in:
@@ -121,6 +121,69 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.path }}"
|
label: "{{ item.path }}"
|
||||||
|
|
||||||
|
- name: Find old daily backups
|
||||||
|
find:
|
||||||
|
paths: "{{ item.path | dirname }}/daily"
|
||||||
|
file_type: file
|
||||||
|
age: 8d
|
||||||
|
age_stamp: ctime
|
||||||
|
patterns: '*.gz'
|
||||||
|
recurse: false
|
||||||
|
register: old_files
|
||||||
|
with_items: "{{ backup_files.results | map(attribute='files') | list }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
|
||||||
|
- name: Print old files
|
||||||
|
debug:
|
||||||
|
var: old_files
|
||||||
|
|
||||||
|
# - name: Delete old daily backups
|
||||||
|
# file:
|
||||||
|
# path: "{{ item.path }}"
|
||||||
|
# state: absent
|
||||||
|
# with_items: "{{ backup_files.results | map(attribute='files') | list }}"
|
||||||
|
# loop_control:
|
||||||
|
# label: "{{ item.path }}"
|
||||||
|
#
|
||||||
|
# - name: Find old weekly backups
|
||||||
|
# find:
|
||||||
|
# paths: "{{ backup_dir }}/{{ item }}/weekly"
|
||||||
|
# file_type: file
|
||||||
|
# age: 5w
|
||||||
|
# age_stamp: ctime
|
||||||
|
# patterns: '*.gz'
|
||||||
|
# recurse: false
|
||||||
|
# register: backup_files
|
||||||
|
# loop: "{{ systems }}"
|
||||||
|
#
|
||||||
|
# - name: Delete old weekly backups
|
||||||
|
# file:
|
||||||
|
# path: "{{ item.path }}"
|
||||||
|
# state: absent
|
||||||
|
# with_items: "{{ backup_files.results | map(attribute='files') | list }}"
|
||||||
|
# loop_control:
|
||||||
|
# label: "{{ item.path }}"
|
||||||
|
#
|
||||||
|
# - name: Find old monthly backups
|
||||||
|
# find:
|
||||||
|
# paths: "{{ backup_dir }}/{{ item }}/monthly"
|
||||||
|
# file_type: file
|
||||||
|
# age: 56w
|
||||||
|
# age_stamp: ctime
|
||||||
|
# patterns: '*.gz'
|
||||||
|
# recurse: false
|
||||||
|
# register: backup_files
|
||||||
|
# loop: "{{ systems }}"
|
||||||
|
#
|
||||||
|
# - name: Delete old monthly backups
|
||||||
|
# file:
|
||||||
|
# path: "{{ item.path }}"
|
||||||
|
# state: absent
|
||||||
|
# with_items: "{{ backup_files.results | map(attribute='files') | list }}"
|
||||||
|
# loop_control:
|
||||||
|
# label: "{{ item.path }}"
|
||||||
|
|
||||||
- name: Inform Mattermost about success
|
- name: Inform Mattermost about success
|
||||||
uri:
|
uri:
|
||||||
url: "{{ mattermost_url }}"
|
url: "{{ mattermost_url }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user