Skip to content

Commit

Permalink
feat: Setup housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Mar 25, 2022
1 parent 36767c7 commit 4864ead
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tasks/deploy_netbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@
group: "{{ netbox_group }}"
loop: "{{ netbox_reports }}"

- name: Schedule daily housekeeping cronjob
cron:
name: "Schedule daily housekeeping cronjob"
special_time: daily
job: "{{ netbox_virtualenv_path }}/bin/python {{ netbox_current_path }}/netbox/manage.py housekeeping"
when:
- netbox_stable and netbox_stable_version is version('3.0.0', '>=')
or netbox_git and _netbox_git_contains_housekeeping.rc == 0

- block:
- name: Run database migrations for NetBox
django_manage:
Expand Down
9 changes: 9 additions & 0 deletions tasks/install_via_git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@
changed_when: False
failed_when: "_netbox_git_contains_trace_paths.rc not in [0, 1]"

- name: Check existence of commit d87ec82, introducing nightly housekeeping command
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^d87ec82fe34d92a84ee6f2a97ba0a87a53eed015'
args:
chdir: "{{ netbox_git_repo_path }}"
executable: /bin/bash
register: _netbox_git_contains_housekeeping
changed_when: False
failed_when: "_netbox_git_contains_housekeeping.rc not in [0, 1]"

- name: Archive and extract snapshot of git repository
shell: 'set -o pipefail; git archive "{{ netbox_git_version }}" | tar -x -C "{{ netbox_git_deploy_path }}"'
args:
Expand Down

0 comments on commit 4864ead

Please sign in to comment.