Move daily backups.

This commit is contained in:
2021-11-23 14:16:23 +01:00
parent d13fdbd78d
commit 120b69070f

View File

@@ -58,5 +58,15 @@
recurse: false
register: backup_files
loop: "{{ backup_dirs.files }}"
loop_control:
label: "{{ item.path }}"
- debug: var=backup_files
- name: Store the daily backup
copy:
remote_src: true
src: "{{ item.path }}"
dest: "{{ item.path | dirname }}/daily/{{ item.path | basename }}"
with_items: "{{ backup_files.results | map(attribute='files') | list }}"
when: (ansible_date_time.weekday_number != "1" and ansible_date_time.day != "01")
loop_control:
label: "{{ item.path }}"