From 6f248cb8d2d6aa4146b1cd7cd3b773706371c3f8 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Thu, 19 Mar 2020 10:32:53 +0100
Subject: [PATCH] Disable maintenance mode before running upgrades

---
 tasks/install.yml | 65 ++++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 34 deletions(-)

diff --git a/tasks/install.yml b/tasks/install.yml
index 846ffe8..101ba7e 100644
--- a/tasks/install.yml
+++ b/tasks/install.yml
@@ -222,48 +222,45 @@
     - nextcloud
     - rainloop
 
-- block:
-
-    - name: Enable Plugins
-      command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings'
-      become_user: '{{ apacheUser }}'
-      ignore_errors: yes
-      with_items: '{{ nextcloud_plugins_public }}'
-      when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0')
-      tags:
-        - deploy
-        - plugins
-
-    - name: Run Upgrade
-      command: '{{ webRoot }}/occ upgrade --no-interaction --no-warnings'
-      become_user: '{{ apacheUser }}'
-      ignore_errors: yes
-      tags:
-        - deploy
-        - plugins
+- name: Enable Plugins
+  command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings'
+  become_user: '{{ apacheUser }}'
+  ignore_errors: yes
+  with_items: '{{ nextcloud_plugins_public }}'
+  when: installed and item.latest_release.version != plugin_versions[item.id]|default('0.0.0')
+  tags:
+    - deploy
+    - plugins
 
-    - name: Enable Plugins
-      command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings'
-      become_user: '{{ apacheUser }}'
-      ignore_errors: yes
-      with_items: '{{ nextcloud_plugins_public }}'
-      when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0')
-      tags:
-        - deploy
-        - plugins
+- name: Disable Maintenance Mode
+  command: '{{ webRoot }}/occ maintenance:mode --off --no-interaction --no-warnings'
+  become_user: '{{ apacheUser }}'
+  ignore_errors: yes
+  tags:
+    - deploy
+    - plugins
 
+- name: Run Upgrade
+  command: '{{ webRoot }}/occ upgrade --no-interaction --no-warnings'
+  become_user: '{{ apacheUser }}'
+  ignore_errors: yes
   when: installed
-
-- name: Configure Spreed
-  include_tasks: spreed.yml
-  when: nextcloud.spreed is defined
   tags:
     - deploy
+    - plugins
 
-- name: Disable Maintenance Mode
-  command: '{{ webRoot }}/occ maintenance:mode --off --no-interaction --no-warnings'
+- name: Enable Plugins
+  command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings'
   become_user: '{{ apacheUser }}'
   ignore_errors: yes
+  with_items: '{{ nextcloud_plugins_public }}'
+  when: installed and item.latest_release.version != plugin_versions[item.id]|default('0.0.0')
   tags:
     - deploy
     - plugins
+
+- name: Configure Spreed
+  include_tasks: spreed.yml
+  when: nextcloud.spreed is defined
+  tags:
+    - deploy
-- 
GitLab