Skip to content

Commit

Permalink
Created the backup error log file in ansible configs and make the err…
Browse files Browse the repository at this point in the history
…ors appending rather than overwrite
  • Loading branch information
alsmk committed Dec 18, 2024
1 parent 0348ae0 commit 626ebe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions infrastructure/server-setup/tasks/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/server-setup/tasks/backups/crontab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
dest: '{{ crontab_user_home }}/backup.sh'
owner: 'root'
mode: 0755

- name: 'Setup crontab to backup the opencrvs data'
when: enable_backups | default(false)
cron:
user: '{{ crontab_user }}'
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' }}"

##
Expand Down

0 comments on commit 626ebe7

Please sign in to comment.