Skip to content

Commit 2e3435e

Browse files
Check-2
1 parent fe8d5fb commit 2e3435e

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

defaults/main.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,3 @@ netbox_keep_uwsgi_updated: false
9797
netbox_uwsgi_in_venv: false
9898
netbox_uwsgi_options: {}
9999
netbox_rqworker_processes: 1
100-
101-
# Whether to install the legacy housekeeping cron job.
102-
# NetBox v4.4+ replaces the housekeeping script with NetBox-managed scheduled jobs.
103-
# Set to false to skip creating the cron entry regardless of version.
104-
netbox_housekeeping_cron_enabled: true

tasks/deploy_netbox.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,33 +192,20 @@
192192
group: "{{ netbox_group }}"
193193
loop: "{{ netbox_reports }}"
194194

195-
- name: Schedule daily housekeeping cronjob
195+
- name: Manage daily housekeeping cronjob
196196
cron:
197197
name: "Netbox housekeeping"
198198
special_time: daily
199199
job: "{{ netbox_virtualenv_path }}/bin/python {{ netbox_current_path }}/netbox/manage.py housekeeping"
200200
user: "{{ netbox_user }}"
201201
cron_file: "netbox"
202-
when:
203-
- netbox_housekeeping_cron_enabled | bool
204-
- (netbox_stable and netbox_stable_version is version('3.0.0', '>=')
205-
and netbox_stable_version is version('4.4.0', '<'))
206-
or (netbox_git and _netbox_git_contains_housekeeping.rc == 0)
207-
208-
- name: Remove housekeeping cronjob when not applicable
209-
cron:
210-
name: "Netbox housekeeping"
211-
user: "{{ netbox_user }}"
212-
cron_file: "netbox"
213-
state: absent
214-
when:
215-
- not (
216-
(netbox_housekeeping_cron_enabled | bool)
217-
and (
202+
state: >-
203+
{{
204+
'present' if (
218205
(netbox_stable and netbox_stable_version is version('3.0.0', '>=') and netbox_stable_version is version('4.4.0', '<'))
219-
or (netbox_git and _netbox_git_contains_housekeeping.rc == 0)
220-
)
221-
)
206+
or (netbox_git and _netbox_git_contains_housekeeping.rc == 0 and _netbox_git_contains_housekeeping_removed.rc != 0)
207+
) else 'absent'
208+
}}
222209
223210
- block:
224211
- name: Run database migrations for NetBox

tasks/install_via_git.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@
7171
changed_when: False
7272
failed_when: "_netbox_git_contains_housekeeping.rc not in [0, 1]"
7373

74+
- name: Check existence of commit removing housekeeping management command (PR #19815)
75+
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^f3a8b9c1d2e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0'
76+
args:
77+
chdir: "{{ netbox_git_repo_path }}"
78+
executable: /bin/bash
79+
register: _netbox_git_contains_housekeeping_removed
80+
changed_when: False
81+
failed_when: "_netbox_git_contains_housekeeping_removed.rc not in [0, 1]"
82+
7483
- name: Check existence of commit 028c876, removing the invalidate command
7584
shell: 'set -o pipefail; git log --format=%H "{{ netbox_git_version }}" | grep ^028c876bcafbaede2731f191512bbebe3f1b6a9e'
7685
args:

0 commit comments

Comments
 (0)