1
0
Fork 0
mash-ansible-role-nextcloud/tasks/adjust_config.yml

68 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2023-03-17 10:34:15 +01:00
---
- 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 }}
2023-03-17 10:34:15 +01:00
- 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
Preview generator setup (#7) * Preview generator setup Enable the variable nextcloud_preview_enabled and you are good to go. Some important aspects of usage: - the preview generator has two stages [according to their readme](https://github.com/nextcloud/previewgenerator) - a generate-all phase, which has to be executed only a single time - a pre-generate phase, that should be run in a cronjob. That runs quite fast if the generate-all phase finishd. We do not want to run the generate-all phase multiple times, so its execution has to be followed somehow. This is done by creating a file on the host side and both the task that executes generate-all and both the cronjob checks its existance. Multiple vaiables are also defined and the corresponding default values are also set. These values are based on the [upstream readme](https://github.com/nextcloud/previewgenerator) and also on experience. Feel free to change anything. Once installed, the playbook needs to be called with the adjust-nextcloud-config tag. This tag sets up the variables and calls the generate-all script, that will also create the file---signalling its finished state---on the host. *** As this may take a long time, be sure to only call it when you have time to leave it running!!! *** The playbook calls generate-all asynchronously, but it will timeout after about 27h. On 60GBs, most if images, it took about 10 minutes to finish. If it takes more time, you may want to start it from the host by calling ```sh /usr/bin/env docker exec mash-nextcloud-server php /var/www/html/occ preview:generate-all ``` If the nextcloud_preview_enabled value is set back to false, the host side files are cleaned up and also the cron job is changed, not to call prevew generation again however, the database and generated previews are kept intact. * fix playbook format suggestions by Slavi (see conversation in !7)
2023-09-16 09:01:20 +02:00
- 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 }}
Preview generator setup (#7) * Preview generator setup Enable the variable nextcloud_preview_enabled and you are good to go. Some important aspects of usage: - the preview generator has two stages [according to their readme](https://github.com/nextcloud/previewgenerator) - a generate-all phase, which has to be executed only a single time - a pre-generate phase, that should be run in a cronjob. That runs quite fast if the generate-all phase finishd. We do not want to run the generate-all phase multiple times, so its execution has to be followed somehow. This is done by creating a file on the host side and both the task that executes generate-all and both the cronjob checks its existance. Multiple vaiables are also defined and the corresponding default values are also set. These values are based on the [upstream readme](https://github.com/nextcloud/previewgenerator) and also on experience. Feel free to change anything. Once installed, the playbook needs to be called with the adjust-nextcloud-config tag. This tag sets up the variables and calls the generate-all script, that will also create the file---signalling its finished state---on the host. *** As this may take a long time, be sure to only call it when you have time to leave it running!!! *** The playbook calls generate-all asynchronously, but it will timeout after about 27h. On 60GBs, most if images, it took about 10 minutes to finish. If it takes more time, you may want to start it from the host by calling ```sh /usr/bin/env docker exec mash-nextcloud-server php /var/www/html/occ preview:generate-all ``` If the nextcloud_preview_enabled value is set back to false, the host side files are cleaned up and also the cron job is changed, not to call prevew generation again however, the database and generated previews are kept intact. * fix playbook format suggestions by Slavi (see conversation in !7)
2023-09-16 09:01:20 +02:00
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"
Preview generator setup (#7) * Preview generator setup Enable the variable nextcloud_preview_enabled and you are good to go. Some important aspects of usage: - the preview generator has two stages [according to their readme](https://github.com/nextcloud/previewgenerator) - a generate-all phase, which has to be executed only a single time - a pre-generate phase, that should be run in a cronjob. That runs quite fast if the generate-all phase finishd. We do not want to run the generate-all phase multiple times, so its execution has to be followed somehow. This is done by creating a file on the host side and both the task that executes generate-all and both the cronjob checks its existance. Multiple vaiables are also defined and the corresponding default values are also set. These values are based on the [upstream readme](https://github.com/nextcloud/previewgenerator) and also on experience. Feel free to change anything. Once installed, the playbook needs to be called with the adjust-nextcloud-config tag. This tag sets up the variables and calls the generate-all script, that will also create the file---signalling its finished state---on the host. *** As this may take a long time, be sure to only call it when you have time to leave it running!!! *** The playbook calls generate-all asynchronously, but it will timeout after about 27h. On 60GBs, most if images, it took about 10 minutes to finish. If it takes more time, you may want to start it from the host by calling ```sh /usr/bin/env docker exec mash-nextcloud-server php /var/www/html/occ preview:generate-all ``` If the nextcloud_preview_enabled value is set back to false, the host side files are cleaned up and also the cron job is changed, not to call prevew generation again however, the database and generated previews are kept intact. * fix playbook format suggestions by Slavi (see conversation in !7)
2023-09-16 09:01:20 +02:00
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
2023-10-01 11:05:45 +02:00
- name: "Create {{ nextcloud_preview_first_run_finished_filename }} to signal, that preview generate-all is finished"
Preview generator setup (#7) * Preview generator setup Enable the variable nextcloud_preview_enabled and you are good to go. Some important aspects of usage: - the preview generator has two stages [according to their readme](https://github.com/nextcloud/previewgenerator) - a generate-all phase, which has to be executed only a single time - a pre-generate phase, that should be run in a cronjob. That runs quite fast if the generate-all phase finishd. We do not want to run the generate-all phase multiple times, so its execution has to be followed somehow. This is done by creating a file on the host side and both the task that executes generate-all and both the cronjob checks its existance. Multiple vaiables are also defined and the corresponding default values are also set. These values are based on the [upstream readme](https://github.com/nextcloud/previewgenerator) and also on experience. Feel free to change anything. Once installed, the playbook needs to be called with the adjust-nextcloud-config tag. This tag sets up the variables and calls the generate-all script, that will also create the file---signalling its finished state---on the host. *** As this may take a long time, be sure to only call it when you have time to leave it running!!! *** The playbook calls generate-all asynchronously, but it will timeout after about 27h. On 60GBs, most if images, it took about 10 minutes to finish. If it takes more time, you may want to start it from the host by calling ```sh /usr/bin/env docker exec mash-nextcloud-server php /var/www/html/occ preview:generate-all ``` If the nextcloud_preview_enabled value is set back to false, the host side files are cleaned up and also the cron job is changed, not to call prevew generation again however, the database and generated previews are kept intact. * fix playbook format suggestions by Slavi (see conversation in !7)
2023-09-16 09:01:20 +02:00
ansible.builtin.file:
path: "{{ nextcloud_preview_host_folder }}/{{ nextcloud_preview_first_run_finished_filename }}"
state: "touch"
mode: 0644
owner: "{{ nextcloud_uid }}"
group: "{{ nextcloud_gid }}"