Adds tasks to gather and run open background jobs on demand (run with --tags run_background_jobs)

This commit is contained in:
Jan Beilicke 2025-04-18 22:54:35 +02:00
parent 23e504e481
commit 8f3f6dd3d5

View file

@ -231,6 +231,30 @@
- nextcloud_database_utils is defined
- nextcloud_database_utils | length > 0
- name: Run background jobs
tags: ['never', 'run_background_jobs']
block:
- name: Get list of background jobs
shell:
chdir: /home/{{ docker_user }}/nextcloud/
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/sh -c './occ background-job:list --output=json'
register: background_jobs
- name: Output background jobs
debug:
msg: "{{ background_jobs.stdout }}"
- name: Run background jobs
shell:
chdir: /home/{{ docker_user }}/nextcloud/
cmd: docker-compose exec -T -u www-data nextcloud-app /bin/sh -c './occ background-job:execute --force-execute {{ item.id }}'
loop: "{{ background_jobs.stdout }}"
register: background_jobs_execution_result
- name: Output background jobs execution result
debug:
msg: "{{ background_jobs_execution_result }}"
- name: "docker-compose: Disable maintenance mode using occ"
shell:
chdir: /home/{{ docker_user }}/nextcloud/