r/nextcloud: Dynamically set version in config

Nextcloud thinks it needs to run the upgrade/migration tool if the
version number in its configuration file does not match the running
version.  It then updates the config file with the correct version. The
next time the configuration policy is applied, however, the version will
revert back to whatever is set in the template.  This will re-trigger
the upgrade notification.

To avoid this problem, we now set the version in the configuration file
dynamically.  Nextcloud writes its version number in a constant in
`version.php`.
ntfy
Dustin 2021-12-20 22:17:14 -06:00
parent 7ab3787798
commit 7d7dda6061
2 changed files with 16 additions and 1 deletions

View File

@ -12,6 +12,21 @@
tags:
- install
- name: check nextcloud version
command: >-
php -r 'require "/usr/share/nextcloud/version.php";
echo join(".", $OC_Version);'
check_mode: false
changed_when: false
register: check_nc_version
tags:
- always
- name: set nc_version fact
set_fact:
nc_version: '{{ check_nc_version.stdout }}'
tags:
- always
- name: ensure nextcloud database user exists
become: true
become_user: postgres

View File

@ -35,7 +35,7 @@ $CONFIG = array (
),
'datadirectory' => '/var/lib/nextcloud/data',
'dbtype' => 'pgsql',
'version' => '20.0.8.1',
'version' => '{{ nc_version }}',
'overwrite.cli.url' => 'https://{{ nextcloud_server_name }}',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',