--- - name: get latest nextcloud version uri: url: https://apps.nextcloud.com/api/v1/platforms.json register: _nextcloud_platforms - name: check if nextcloud is installed stat: path: "{{nextcloud_directory}}/version.php" register: _nextcloud_version_file_stat - name: get actual nextcloud version command: php -r 'include("{{nextcloud_directory}}/version.php");print($OC_VersionString);' become: true become_user: www-data become_method: sudo changed_when: false when: _nextcloud_version_file_stat.stat.isreg is defined register: _nextcloud_get_actual_version_command - name: ensure that upgrade is happening assert: that: _nextcloud_actual_version is version(nextcloud_version, operator='<=', strict=True) or nextcloud_force_downgrade msg: refusing to downgrade from {{_nextcloud_actual_version}} to {{nextcloud_version}} when: - nextcloud_state == 'updated' - _nextcloud_do_update - name: nextcloud update version information debug: msg: nextcloud_actual_version: "{{_nextcloud_actual_version}}" nextcloud_target_version: "{{nextcloud_version}}" nextcloud_latest_version: "{{_nextcloud_latest_version}}" when: - nextcloud_state == 'updated' - _nextcloud_do_update - name: stop apache2 service: name: apache2 state: stopped when: - nextcloud_state == 'updated' - _nextcloud_do_update