Skip to content
Snippets Groups Projects
Chris Croome's avatar
Chris Croome authored
34b55258
History

Webarchitects Nextcloud Ansible Role

This repo contains an Ansible Galaxy role to install Nextcloud, see the defaults/main.yml.

For new installs the latest Nextcloud version will be installed and for existing installs outstanding upgrades will be applied, when nextcloud_autoupdate is set to true, if multiple upgrades are required then the role needs to be run multiple times.

This role imports the ClamAV and Coturn roles for the anti-virus app and Nextcloud Talk if these are set to be installed (they are not by default).

This role can be used with the ONLYOFFICE Document Server role, see the Nextcloud development server repo for an example of how this works.

Note that this role has only been tested based on the assumption that the user running Nextcloud (either via Apache and mod_php and mod_itk or via a PHP FPM pool) and the database user are the same, eg nextcloud, some work might be needed to enable it to be used to run Nextcloud as www-data.

Nextcloud configuration

Get the existing config as YAML:

occ config:list --private | jq | yq -o=yaml -P

Add a admin user:

occ user:add --display-name="Webarchitects Admin" webarch
occ user:setting webarch settings email "chris@webarchitects.co.uk"
occ group:adduser admin webarch

Full text search

the Elasticsearch role can be used to install Elasticsearch, then these apps need to be installed:

This role will configure the Elasticsearch login and Systemd to keep the index updated but it should be manually created to start with, stop the systemd unit as root:

service nextcloud-fulltext-elasticsearch-worker stop

Then as the Nextcloud user manually create the initial index:

occ fulltextsearch:stop
occ fulltextsearch:index

Then restart the systemd unit file.

For debugging Elasticsearch, get a list of indexes:

curl http://localhost:9200/_cat/indices

Repo History

The Ansible Nextcloud project that was at https://git.coop/webarch/nextcloud has moved to git.coop/webarch/nextcloud-server.

Copyright

Copyright 2019-2025 Chris Croome, <chris@webarchitects.co.uk>.

This role is released under the same terms as Ansible itself, the GNU GPLv3.