Update to 2021-02-19 17:00

master
Daniel Berteaud 4 years ago
parent 01b9c2519c
commit 279527d27a
  1. BIN
      roles/metabase/defaults/.main.yml.swp
  2. 7
      roles/metabase/tasks/install.yml
  3. 3
      roles/metabase/templates/post-backup.j2
  4. 13
      roles/metabase/templates/pre-backup.j2

@ -44,3 +44,10 @@
- db_server: "{{ metabase_db_server }}" - db_server: "{{ metabase_db_server }}"
- db_pass: "{{ metabase_db_pass }}" - db_pass: "{{ metabase_db_pass }}"
tags: metabase tags: metabase
- name: Install pre and post backup hooks
template: src={{ item }}-backup.j2 dest=/etc/backup/{{ item }}.d/metabase mode=700
loop:
- pre
- post
tags: metabase

@ -0,0 +1,3 @@
#!/bin/bash -e
rm -f {{ metabase_root_dir }}/backup/*

@ -0,0 +1,13 @@
#!/bin/bash -e
/usr/bin/mysqldump \
{% if metabase_db_server not in ['localhost','127.0.0.1'] %}
--user={{ metabase_db_user | quote }} \
--password={{ metabase_db_pass | quote }} \
--host={{ metabase_db_server | quote }} \
--port={{ metabase_db_port | quote }} \
{% endif %}
--quick --single-transaction \
--add-drop-table {{ metabase_db_name | quote }} | zstd -c > {{ metabase_root_dir }}/backup/{{ metabase_db_name }}.sql.zst
cp {{ metabase_root_dir }}/etc/env {{ metabase_root_dir }}/backup/
Loading…
Cancel
Save