From 0f12ffd51365504e70ffe40137abf166fb5f7622 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 29 Apr 2025 07:27:12 +0200 Subject: [PATCH] Optimized nextcloud plugin tasks --- roles/docker-nextcloud/tasks/plugin.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/docker-nextcloud/tasks/plugin.yml b/roles/docker-nextcloud/tasks/plugin.yml index bde50834..3d511046 100644 --- a/roles/docker-nextcloud/tasks/plugin.yml +++ b/roles/docker-nextcloud/tasks/plugin.yml @@ -35,18 +35,18 @@ become: false register: plugin_vars_file -- name: Apply configuration to {{ plugin_key }} - block: - - name: Load {{ plugin_key }} configuration variables - include_vars: - file: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml" - - - name: "Set {{ item.configkey }} for {{ item.appid }}" - loop: "{{ plugin_configuration }}" - command: > - {{ nextcloud_docker_exec_occ }} config:app:set {{ item.appid }} {{ item.configkey }} --value '{{ item.configvalue | to_json if item.configvalue is mapping else item.configvalue }}' - changed_when: "'Config value were not updated' not in stdout" +- name: "Load {{ plugin_key }} configuration variables" + include_vars: + file: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml" + when: plugin_vars_file.stat.exists + +- name: "Set {{ item.configkey }} for {{ item.appid }}" + loop: "{{ plugin_configuration }}" + command: > + {{ nextcloud_docker_exec_occ }} config:app:set {{ item.appid }} {{ item.configkey }} --value '{{ item.configvalue | to_json if item.configvalue is mapping else item.configvalue }}' + register: config_set_result + changed_when: (config_set_result.stdout is defined) and ("Config value were not updated" not in config_set_result.stdout) when: plugin_vars_file.stat.exists - name: Check if {{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml exists