83 lines
3.9 KiB
YAML
83 lines
3.9 KiB
YAML
---
|
|
|
|
- when: nextcloud_container_labels_traefik_enabled | bool
|
|
name: Ensure trusted_proxies is correctly set when reverse-proxying via Traefik
|
|
block:
|
|
- name: Determine Nextcloud container network subnet
|
|
ansible.builtin.command:
|
|
cmd: "{{ devture_systemd_docker_base_host_command_docker }} network inspect {{ nextcloud_container_labels_traefik_docker_network }} -f '{% raw %}{{ (index .IPAM.Config 0).Subnet }}{% endraw %}'"
|
|
register: nextcloud_reverse_proxy_container_network_subnet_result
|
|
changed_when: false
|
|
|
|
- name: Adjust Nextcloud configuration (set trusted_proxies)
|
|
ansible.builtin.command:
|
|
cmd: |-
|
|
docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ --no-warnings config:system:set trusted_proxies 0 --type=string --value={{ nextcloud_reverse_proxy_container_network_subnet_result.stdout }}
|
|
|
|
- name: Adjust Nextcloud configuration (custom parameters)
|
|
ansible.builtin.command:
|
|
cmd: |-
|
|
docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ --no-warnings config:system:set {{ item.key }} --type="{{ item.type }}" --value={{ item.value }}
|
|
with_items: "{{ nextcloud_config_parameters }}"
|
|
|
|
- name: Update database indices
|
|
ansible.builtin.command:
|
|
cmd: |-
|
|
docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ db:add-missing-indices
|
|
|
|
- when: nextcloud_preview_enabled | bool
|
|
block:
|
|
- name: Adjust Nextcloud configuration values related to preview generator
|
|
ansible.builtin.command:
|
|
cmd: |-
|
|
docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ {{ item.appType }} {{ item.appConfig }} {{ item.configName }} --value={{ item.value }}
|
|
with_items:
|
|
- appType: "config:app:set"
|
|
appConfig: "previewgenerator"
|
|
configName: "squareSizes"
|
|
value: "{{ nextcloud_preview_squareSizes }}"
|
|
- appType: "config:app:set"
|
|
appConfig: "previewgenerator"
|
|
configName: "widthSizes"
|
|
value: "{{ nextcloud_preview_widthSizes }}"
|
|
- appType: "config:app:set"
|
|
appConfig: "previewgenerator"
|
|
configName: "heightSizes"
|
|
value: "{{ nextcloud_preview_heightSizes }}"
|
|
- appType: "config:system:set"
|
|
appConfig: ""
|
|
configName: "preview_max_x"
|
|
value: "{{ nextcloud_preview_preview_max_x }}"
|
|
- appType: "config:system:set"
|
|
appConfig: ""
|
|
configName: "preview_max_y"
|
|
value: "{{ nextcloud_preview_preview_max_y }}"
|
|
- appType: "config:system:set"
|
|
appConfig: ""
|
|
configName: "jpeg_quality"
|
|
value: "{{ nextcloud_preview_system_jpeg_quality }}"
|
|
- appType: "config:app:set"
|
|
appConfig: "preview"
|
|
configName: "jpeg_quality"
|
|
value: "{{ nextcloud_preview_app_jpeg_quality }}"
|
|
|
|
- name: "Check if {{ nextcloud_preview_first_run_finished_filename }} exists"
|
|
ansible.builtin.stat:
|
|
path: "{{ nextcloud_preview_host_folder }}/{{ nextcloud_preview_first_run_finished_filename }}"
|
|
register: nextcloud_preview_file_stats
|
|
|
|
- when: not nextcloud_preview_file_stats.stat.exists
|
|
name: Start preview generate-all
|
|
ansible.builtin.command:
|
|
cmd: |-
|
|
docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ preview:generate-all
|
|
async: 100000
|
|
poll: 10
|
|
|
|
- name: "Create {{ nextcloud_preview_first_run_finished_filename }} to signal, that preview generate-all is finished"
|
|
ansible.builtin.file:
|
|
path: "{{ nextcloud_preview_host_folder }}/{{ nextcloud_preview_first_run_finished_filename }}"
|
|
state: "touch"
|
|
mode: 0644
|
|
owner: "{{ nextcloud_uid }}"
|
|
group: "{{ nextcloud_gid }}"
|