You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4KB

  1. ---
  2. - name: get latest nextcloud version
  3. uri:
  4. url: https://apps.nextcloud.com/api/v1/platforms.json
  5. register: _nextcloud_platforms
  6. - name: check if nextcloud is installed
  7. stat:
  8. path: "{{nextcloud_directory}}/version.php"
  9. register: _nextcloud_version_file_stat
  10. - name: get actual nextcloud version
  11. command: php -r 'include("{{nextcloud_directory}}/version.php");print($OC_VersionString);'
  12. become: true
  13. become_user: www-data
  14. become_method: sudo
  15. changed_when: false
  16. when: _nextcloud_version_file_stat.stat.isreg is defined
  17. register: _nextcloud_get_actual_version_command
  18. - name: ensure that upgrade is happening
  19. assert:
  20. that: _nextcloud_actual_version is version(nextcloud_version, operator='<=', strict=True) or nextcloud_force_downgrade
  21. msg: refusing to downgrade from {{_nextcloud_actual_version}} to {{nextcloud_version}}
  22. when:
  23. - nextcloud_state == 'updated'
  24. - _nextcloud_do_update
  25. - name: nextcloud update version information
  26. debug:
  27. msg:
  28. nextcloud_actual_version: "{{_nextcloud_actual_version}}"
  29. nextcloud_target_version: "{{nextcloud_version}}"
  30. nextcloud_latest_version: "{{_nextcloud_latest_version}}"
  31. when:
  32. - nextcloud_state == 'updated'
  33. - _nextcloud_do_update
  34. - name: stop apache2
  35. service:
  36. name: apache2
  37. state: stopped
  38. when:
  39. - nextcloud_state == 'updated'
  40. - _nextcloud_do_update