Skip to content

swcc/ansible-nextcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nextcloud Ansible role

Build Status Ansible Galaxy

Installs nextcloud from nextcloud.com servers sources. This role assumes you will run nextcloud with PHP-FPM and thus installs it for you as an ansible role dependency (with the NBZ4live.php-fpm role.

Example Playbook

Basic example playbook:

- hosts: webservers
  roles:
    - role: swcc.nextcloud
      nextcloud_destination: /home/nextcloud
      nextcloud_version: 19.0.3

Role parameters

Variable Default Type Description
nextcloud_version 20.0.2 string Which nextcloud version to install
nextcloud_destination /var/www string Where to install Nextcloud (will be installed in "{{ nextcloud_destination}}/nextcloud/" directory on your filesystem)
nextcloud_dir_user www-data string Which unix user should own the installed directory
nextcloud_dir_group www-data string Which unix group should own the installed directory
nextcloud_php_memory_limit 512M string Php memory_limit setting. Default recommanded by Nextcloud is 512M.
nextcloud_config {} dict a dict object of key values to set in the config/config.php file of Nextcloud. Beware of the content as they need to be valid PHP values. E.g. a string should be defined in your ansible dictionnary as "'mystring'" for the value to be the litteral 'mystring' in the config.php file.
nextcloud_onlyoffice_force_flush_period undefined string Hack taken from https://help.nextcloud.com/t/onlyoffice-data-loss/20586/5 to flush onlyoffice changes to disk at regular intervals. E.g. value can be 300s to flush data every 5 minutes.

Optional, backup related variables:

Variable Default Type Description
nextcloud_backup - object Define this object if you want to backup both the database and the data dir of your Nextcloud instance.
nextcloud_backup.destination_server - string Destination backup server which will receive all files (via rsync)
nextcloud_backup.retention 7 number Number of days of database backups to keep on the instance
nextcloud_backup.directory nextcloud_destination + '/nextcloud/data' string Path of the Nextcloud data directory to backup
nextcloud_backup.pg - object Connection details to the database. See below for details of the object keys.
nextcloud_backup.pg.pg_dump_binary - string Path of the pg_dump binary on the server
nextcloud_backup.pg.host localhost string Host of the postgresql database
nextcloud_backup.pg.port 5432 string Port of the postgresql database
nextcloud_backup.pg.dbname nextcloud string Name of the postgresql database
nextcloud_backup.pg.username nextcloud string User of the postgresql database
nextcloud_backup.pg.password - string Password of the postgresql database

⚠️ Please also check the php-fpm variables of the dependent php-fpm ansible role before running this current role. ⚠️

Most importantly check the php version you want to run by setting the php_fpm_version variable. Here is an example configuration of the php-fpm dependent role which should suit most needs:

php_fpm_version: 7.4

php_fpm_pool_defaults:
  pm: dynamic
  pm.max_children: 10
  pm.start_servers: 2
  pm.min_spare_servers: 1
  pm.max_spare_servers: 4
php_fpm_pools:
  - name: www
    user: www-data
    group: www-data
    listen: "/run/php/php{{ php_fpm_version }}-fpm.sock"
    listen.owner: www-data
    listen.group: www-data
    chdir: /var/www
    env:
      PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
      TMPDIR: "/tmp"
      TMP: "/tmp"
      HOSTNAME: "$HOSTNAME"

Makefile for easier Ansible usage

I have written a small Makefile to make your future ansible runs easier. Don't hesitate to check it out.

Download the *.deb package from the github releases, install it and start using it with ansible-make help.

License

GPLv3

About

Install and configure Nextcloud with Ansible

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published