mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-04 15:47:32 +02:00
Update to 2022-03-07 14:00
This commit is contained in:
17
roles/unmaintained/wh_backend/templates/pre_backup.sh.j2
Normal file
17
roles/unmaintained/wh_backend/templates/pre_backup.sh.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
{% for client in wh_clients %}
|
||||
{% for app in client.apps | default([]) %}
|
||||
{% set app = wh_default_app | combine(app, recursive=True) %}
|
||||
{% if app.backend | default(client.backend) | default(wh_defaults.backend) == inventory_hostname %}
|
||||
mysqldump --add-drop-table --single-transaction \
|
||||
--host={{ (wh_default_app | combine(app)).database.server | default(mysql_server) }} \
|
||||
--user={{ client.name[0:7] }}_{{ app.name[0:7] }} \
|
||||
--password="{{ (wh_default_app | combine(app)).database.pass | default((wh_pass_seed | password_hash('sha256', 65534 | random(seed=client.name + app.name) | string))[9:27] ) }}" \
|
||||
{{ client.name[0:7] }}_{{ app.name[0:7] }} | \
|
||||
zstd -c > /opt/wh/{{ client.name }}/apps/{{ app.name }}/db_dumps/{{ client.name[0:7] }}_{{ app.name[0:7] }}.sql.zst
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
Reference in New Issue
Block a user