From 164c55e10edf96f569249d9fc72d3a3789d46b90 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 22 Nov 2021 05:38:00 +0100 Subject: [PATCH] Use variable for local backup dir and compress backups. --- hetzner.yaml | 8 +++++++- vars/hetzner/variable.yaml | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hetzner.yaml b/hetzner.yaml index 739d3e1..d6b1a4d 100644 --- a/hetzner.yaml +++ b/hetzner.yaml @@ -28,10 +28,16 @@ loop_control: label: "{{ item.key }}" + - name: Compress database backups + shell: gzip {{ backup_dir }}/{{ item.key }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql + loop: "{{ lookup('dict', customers) }}" + loop_control: + label: "{{ item.key }}" + - name: Fetch backups fetch: src: "{{ backup_dir }}/{{ item.key }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql" - dest: "/backup/{{ item.key }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql" + dest: "{{ local_backup }}/{{ item.key }}/" flat: yes loop: "{{ lookup('dict', customers) }}" loop_control: diff --git a/vars/hetzner/variable.yaml b/vars/hetzner/variable.yaml index ea6f3d9..ee01039 100644 --- a/vars/hetzner/variable.yaml +++ b/vars/hetzner/variable.yaml @@ -19,3 +19,5 @@ customers: roundcube: database: roundcube +local_backup: /home/semaphore/backup +