Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-li committed Dec 14, 2023
2 parents bdf862e + 029b14f commit 87ee535
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bootstrap/ansible/main.copyme
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ log_path: /var/log/user_portals/cf_mybrc
portal_log_file: cf_mybrc_portal.log
api_log_file: cf_mybrc_api.log
logrotate_entry_name: cf_mybrc
# TODO: Logs are only backed up if a path to an existent directory is given.
log_backup_dir_path:

# Apache settings.
# The name of the copy of the generated WSGI template in the Apache directory.
Expand Down
15 changes: 15 additions & 0 deletions bootstrap/ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@
src: "{{ git_prefix }}/{{ reponame }}/bootstrap/ansible/logrotate.tmpl"
dest: /etc/logrotate.d/{{ logrotate_entry_name }}

- name: Check if an existent directory is given for backing up Django API and portal logs
stat:
path: "{{ log_backup_dir_path }}"
register: log_backup_dir_info

- name: Install a cron job to back up rotated Django API and portal logs if a directory is given
# This job is installed to /var/spool/cron/root.
ansible.builtin.cron:
name: "Back up rotated Django API and portal logs"
minute: "0"
hour: "0"
day: "15"
job: "mv {{ log_path }}/*.gz {{ log_backup_dir_path }}"
when: log_backup_dir_info.stat.exists and log_backup_dir_info.stat.isdir

# Prepare the Python virtual environment for the Django application.

- name: Create Python virtual environment directory
Expand Down

0 comments on commit 87ee535

Please sign in to comment.