chore(server): allow configuring nextcloud background job mode
This commit is contained in:
parent
f2e66f002b
commit
80317cae6a
@ -10,6 +10,8 @@ nextcloud_data_path: "{{ nextcloud_basepath }}/data"
|
||||
nextcloud_storage_path: "{{ nextcloud_basepath }}/storage"
|
||||
nextcloud_fpm_config_path: "{{ nextcloud_basepath }}/fpm-config"
|
||||
|
||||
nextcloud_background_job_mode: cron
|
||||
|
||||
nextcloud_database_type: sqlite
|
||||
nextcloud_database_name: nextcloud
|
||||
nextcloud_database_user: nextcloud
|
||||
|
@ -70,6 +70,7 @@
|
||||
mode: "0640"
|
||||
owner: root
|
||||
group: root
|
||||
when: nextcloud_background_job_mode == 'cron'
|
||||
notify:
|
||||
- reload-systemd
|
||||
|
||||
@ -80,22 +81,12 @@
|
||||
mode: "0640"
|
||||
owner: root
|
||||
group: root
|
||||
when: nextcloud_background_job_mode == 'cron'
|
||||
notify:
|
||||
- reload-systemd
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Enable systemd timer for nextcloud cron
|
||||
systemd:
|
||||
name: "nextcloud-cron.timer"
|
||||
enabled: yes
|
||||
|
||||
- name: Ensure systemd timer for nextcloud cron is started
|
||||
systemd:
|
||||
name: "nextcloud-cron.timer"
|
||||
state: started
|
||||
|
||||
|
||||
- name: Ensure docker container for nextcloud is running
|
||||
docker_container:
|
||||
name: "{{ nextcloud_container_name }}"
|
||||
@ -107,3 +98,35 @@
|
||||
purge_networks: "{{ nextcloud_container_purge_other_networks }}"
|
||||
restart_policy: "{{ nextcloud_container_restart_policy }}"
|
||||
state: started
|
||||
|
||||
- name: Enable systemd timer for nextcloud cron
|
||||
systemd:
|
||||
name: "nextcloud-cron.timer"
|
||||
enabled: yes
|
||||
when: nextcloud_background_job_mode == 'cron'
|
||||
|
||||
- name: Ensure systemd timer for nextcloud cron is started
|
||||
systemd:
|
||||
name: "nextcloud-cron.timer"
|
||||
state: started
|
||||
when: nextcloud_background_job_mode == 'cron'
|
||||
|
||||
- name: Check nextcloud background job mode
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ nextcloud_container_name }}"
|
||||
command: "{{ nextcloud_occ_command }} config:app:get core backgroundjobs_mode"
|
||||
user: "{{ nextcloud_user_info.uid }}"
|
||||
tty: yes
|
||||
register: nextcloud_current_backgroundjob_mode
|
||||
# As nextcloud might still be starting, retry this task
|
||||
retries: 5
|
||||
delay: 5
|
||||
changed_when: false
|
||||
|
||||
- name: Set nextcloud background job mode to {{ nextcloud_background_job_mode }}
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ nextcloud_container_name }}"
|
||||
command: "{{ nextcloud_occ_command }} config:app:set core backgroundjobs_mode {{ nextcloud_background_job_mode }}"
|
||||
user: "{{ nextcloud_user_info.uid }}"
|
||||
tty: yes
|
||||
when: nextcloud_current_backgroundjob_mode.stdout != nextcloud_background_job_mode
|
||||
|
@ -22,3 +22,5 @@ nextcloud_container_base_environment_yaml: |+2
|
||||
{% elif nextcloud_database_type == 'sqlite' %}
|
||||
SQLITE_DATABASE: "{{ nextcloud_database_name }}"
|
||||
{% endif %}
|
||||
|
||||
nextcloud_occ_command: "php occ"
|
||||
|
Loading…
Reference in New Issue
Block a user