/upgrade-nextcloud

Upgrade an instance of nextcloud through ansible

Primary LanguagePHPBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Build Status

upgrade-nextcloud

This role upgrades an Nextcloud instance on a debian/Ubuntu server.

The role's main actions are:

  • Version comparison
  • Nextcloud's instance backup. (db, rootDir, dataDir)
  • Upgrade using nextcloud's CLI
  • Strengthened files permissions and ownership following Nextcloud recommendations.

based on https://docs.nextcloud.com/server/10/admin_manual/maintenance/manual_upgrade.html

Requirements

Ansible version

Ansible 2.0

Root access

This role requires root access, so either configure it in your inventory files, run it in a playbook with a global become: yes or invoke the role in your playbook like:

playbook.yml:

- hosts: dnsserver
  roles:
    - role: aalaesar.upgrade-nextcloud
      become: yes

Role Variables

Role's variables (and their default value):

Configuration

Source location will be calculated following channel, version and branch values.

nextcloud_channel: "releases"

Defines the version channel you want to use for the upgrade. Available : releases | prereleases | daily | latest

nextcloud_version: 10.0.2

Specify the version name for channels releases, prereleases and daily. (it may not be numbers at all)

nextcloud_branch: "stable"

Specify the branch name for daily & latest channel

nextcloud_repository: "https://download.nextcloud.com/server"

The Nextcloud's official repository. You may change it if you have the sources somewhere else.

Main configuration

nextcloud_websrv: "apache"

The http server used by nextcloud. Available values are: apache or nginx.

nextcloud_webroot: "/opt/nextcloud"

The Nextcloud root directory.

nextcloud_data_dir: "/var/ncdata"

The Nextcloud data directory location. It is important to specify its location if it is located is the same directory as Nextcloud

nextcloud_backup_dir: "{{nextcloud_webroot}}_bkp"

Directory where the nextcloud backup will be stored

nextcloud_webroot_old: "{{nextcloud_webroot}}_old"

Directory where the previous nextcloud instance will be stored

Database configuration

nextcloud_db_backup: true

Whenever the role should backup the instance's database on the same host.

nextcloud_db_host: "127.0.0.1"

The database server's ip/hostname where Nextcloud's database is located.

nextcloud_db_backend: "mysql"

Database type used by nextcloud.

Supported values are:

  • mysql
  • mariadb
  • pgsql (PostgreSQL)
nextcloud_db_name: "nextcloud"

The Nextcloud instance's database name.

nextcloud_db_admin: "ncadmin"

The Nextcloud instance's database user's login

nextcloud_db_pwd: false

The Nextcloud instance's database user's password --required!!--

OPTIONS

nextcloud_restore_3rdparty_apps: true

will copy the installed/downloaded apps in your new instance

nextcloud_db_backup: true

Specify if the database backup is required during the upgrade

nextcloud_upgrade_clean: true

Should the upgrade process remove the old Nextcloud instance files once upgraded successfully ?

System configuration

nextcloud_websrv_user: "www-data"

system user for the http server

nextcloud_websrv_group: "www-data"

system group for the http server

Dependencies

none

Example Playbook

--TODO-- License

BSD