1
0
Fork 0
mash-ansible-role-nextcloud/tasks/adjust_config.yml
Tiz 05a1713402
Update adjust_config.yml - remove type for preview generator
adjust-nextcloud-config tags is returning an error `Unknown type integer`  when setting the type to int or integer for jpeg_quality. 
This workaround proposes to remove the "type=" as the playbook works well without
2024-10-02 11:29:40 +00:00

67 lines
3.3 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 }} --value={{ item.value }} -- {{ item.appConfig }} {{ item.configName }}
with_items:
- 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: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 }}"