- name: Active le mode maintenance # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: './console maintenance:mode --on' args: chdir: "{{ nextcloud_webroot }}" - name: Update nextcloud root dir symbolic link become: true ansible.builtin.file: src: "{{ nextcloud_source }}" dest: "{{ nextcloud_webroot }}/nextcloud" owner: nextcloud group: nextcloud state: link follow: false - name: Update nextcloud common app dir symbolic link become: true ansible.builtin.file: src: "{{ nextcloud_common }}" dest: "{{ nextcloud_webroot }}/common" owner: nextcloud group: nextcloud state: link follow: false - name: Desactive le mode maintenance # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: './console maintenance:mode --off' args: chdir: "{{ nextcloud_webroot }}" - name: Run nextcloud upgrade script # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: ./console upgrade args: chdir: "{{ nextcloud_webroot }}" register: nc_upgrade_result - name: Display upgrade result debug: var: nc_upgrade_result.stdout_lines - name: Bloc de tâches contrôlant la fin de la maintenance de mise à jour block: - name: Wait for nextcloud maintenance mode to become false # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: ./console status args: chdir: "{{ nextcloud_webroot }}" register: result until: "'maintenance: false' in result.stdout" retries: 15 delay: 20 rescue: - name: Deactivate maintenance mode manually # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: ./console maintenance:mode --off args: chdir: "{{ nextcloud_webroot }}" register: rescue - name: Display rescue ansible.builtin.debug: var: rescue.stdout_lines - name: Lancement de commande de maintenance # noqa : command-instead-of-module become_user: "{{ nextcloud_php_user }}" become: true ansible.builtin.command: "./console {{ command }}" args: chdir: "{{ nextcloud_webroot }}" loop: - db:add-missing-columns - db:add-missing-indices - db:add-missing-primary-keys loop_control: loop_var: command register: nc_indices_cmd - name: Display each occ commands result ansible.builtin.debug: msg: "{{ item.stdout_lines }}" loop: "{{ nc_indices_cmd.results }}" loop_control: label: "{{ item.command }}" - name: Reload php fpm service become: true ansible.builtin.service: name: "{{ php_fpm_service }}" state: reloaded