From e7402c892a9a2b84ee734a2d6c128035a4556fd7 Mon Sep 17 00:00:00 2001 From: Christian Steinle Date: Thu, 18 Nov 2021 06:47:46 +0100 Subject: [PATCH] Move the backups to the right folders. --- odroid.yaml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/odroid.yaml b/odroid.yaml index 010049e..8d26d62 100644 --- a/odroid.yaml +++ b/odroid.yaml @@ -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") - \ No newline at end of file