Move the backups to the right folders.

This commit is contained in:
2021-11-18 06:47:46 +01:00
parent 8c7c7d4aeb
commit e7402c892a

View File

@@ -62,10 +62,34 @@
label: "{{ item.item[0] }} {{ item.item[1] }}"
- name: Store the yearly backups
copy:
remote_src: true
src: "{{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
dest: "{{ backup_dir }}/{{ item }}/yearly/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
loop: "{{ databases }}"
when: (ansible_date_time.day == "01" and ansible_data_time.month == "01")
- name: Store the monthly backups
copy:
remote_src: true
src: "{{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
dest: "{{ backup_dir }}/{{ item }}/monthly/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
loop: "{{ databases }}"
when: (ansible_date_time.day == "01" and ansible_data_time.month != "01")
- name: Store the weekly backups
copy:
remote_src: true
src: "{{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
dest: "{{ backup_dir }}/{{ item }}/weekly/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
loop: "{{ databases }}"
when: (ansible_date_time.weekday_number == "7")
- name: Store the daily backups
copy:
remote_src: true
src: "{{ backup_dir }}/{{ item }}/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
dest: "{{ backup_dir }}/{{ item }}/daily/{{ ansible_date_time.iso8601_basic_short }}.sql.gz"
loop: "{{ databases }}"
when: (ansible_date_time.weekday_number != "7" and ansible_date_time.day != "01")