From 626ebe70308c18244f89faa5ccba779164898c40 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 18 Dec 2024 14:19:01 +0600 Subject: [PATCH] Created the backup error log file in ansible configs and make the errors appending rather than overwrite --- infrastructure/server-setup/tasks/application.yml | 8 ++++++++ infrastructure/server-setup/tasks/backups/crontab.yml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/infrastructure/server-setup/tasks/application.yml b/infrastructure/server-setup/tasks/application.yml index 4d70e66b4..ea17532e7 100644 --- a/infrastructure/server-setup/tasks/application.yml +++ b/infrastructure/server-setup/tasks/application.yml @@ -48,6 +48,14 @@ group: 'application' state: touch mode: 'u+rwX,g+rwX,o-rwx' + +- name: Create backup logfile for errors + ansible.builtin.file: + path: /var/log/opencrvs-backup.error.log + owner: '{{ ansible_user }}' + group: 'application' + state: touch + mode: 'u+rwX,g+rwX,o-rwx' - name: Create restore logfile ansible.builtin.file: diff --git a/infrastructure/server-setup/tasks/backups/crontab.yml b/infrastructure/server-setup/tasks/backups/crontab.yml index cc57ecf4a..de20cf313 100644 --- a/infrastructure/server-setup/tasks/backups/crontab.yml +++ b/infrastructure/server-setup/tasks/backups/crontab.yml @@ -12,7 +12,7 @@ dest: '{{ crontab_user_home }}/backup.sh' owner: 'root' mode: 0755 - + - name: 'Setup crontab to backup the opencrvs data' when: enable_backups | default(false) cron: @@ -20,7 +20,7 @@ name: 'backup opencrvs' minute: '0' hour: '0' - job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2> /var/log/opencrvs-backup.error.log' + job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2>> /var/log/opencrvs-backup.error.log' state: "{{ 'present' if (backup_hostname is defined and backup_encryption_passphrase and (enable_backups | default(false))) else 'absent' }}" ##