From 118b4206639d29e89df76c0683bb06e11a899abd Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 4 Jun 2020 18:00:06 +0200 Subject: [PATCH] Update to 2020-06-04 18:00 --- roles/zabbix_server/defaults/main.yml | 2 +- roles/zabbix_server/templates/pre_backup.sh.j2 | 30 ++++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/roles/zabbix_server/defaults/main.yml b/roles/zabbix_server/defaults/main.yml index aff2405..ba83c20 100644 --- a/roles/zabbix_server/defaults/main.yml +++ b/roles/zabbix_server/defaults/main.yml @@ -52,6 +52,6 @@ zabbix_server_auth_http: False # zabbix_server_matrix_access_token: ... # Zabbix DB can be huge. If zabbix_server_backup_on_full_only is true -# pre-backup will skip history tables from the dump. Except is called with +# pre-backup will skip history tables from the dump. Except if called with # pre-backup full zabbix_server_backup_on_full_only: False diff --git a/roles/zabbix_server/templates/pre_backup.sh.j2 b/roles/zabbix_server/templates/pre_backup.sh.j2 index a684367..5f0a090 100644 --- a/roles/zabbix_server/templates/pre_backup.sh.j2 +++ b/roles/zabbix_server/templates/pre_backup.sh.j2 @@ -14,25 +14,27 @@ mkdir -p /home/lbkp/zabbix {% if zabbix_server_backup_on_full_only %} if [[ "$1" == "full" ]]; then /usr/bin/mysqldump --user={{ zabbix_server_db_user | quote }} \ - --password={{ zabbix_server_db_pass | quote }} \ - --host={{ zabbix_server_db_server | quote }} \ - --port={{ zabbix_server_db_port }} \ - --no-create-info \ - --quick --single-transaction \ - --add-locks \ - {{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst + --password={{ zabbix_server_db_pass | quote }} \ + --host={{ zabbix_server_db_server | quote }} \ + --port={{ zabbix_server_db_port }} \ + --no-create-info \ + --quick --single-transaction \ + --add-locks \ + {{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst else {% endif %} /usr/bin/mysqldump --user={{ zabbix_server_db_user | quote }} \ - --password={{ zabbix_server_db_pass | quote }} \ - --host={{ zabbix_server_db_server | quote }} \ - --port={{ zabbix_server_db_port }} \ - --no-create-info \ + --password={{ zabbix_server_db_pass | quote }} \ + --host={{ zabbix_server_db_server | quote }} \ + --port={{ zabbix_server_db_port }} \ + --no-create-info \ +{% if zabbix_server_backup_on_full_only %} {% for table in ['events', 'history', 'history_uint', 'history_str', 'history_text', 'trends', 'trends_uint'] %} - --ignore-table={{ zabbix_server_db_name }}.{{ table }} \ + --ignore-table={{ zabbix_server_db_name }}.{{ table }} \ {% endfor %} - --quick --single-transaction \ - --add-locks \ +{% endif %} + --quick --single-transaction \ + --add-locks \ {{ zabbix_server_db_name | quote }} | zstd -T0 -c > /home/lbkp/zabbix/{{ zabbix_server_db_name }}_data.sql.zst {% if zabbix_server_backup_on_full_only %} fi