Giter Site home page Giter Site logo

zerwes / ansible-role-nextcloud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from systemli/ansible-role-nextcloud

0.0 0.0 0.0 267 KB

Ansible role to maintain (install and upgrade) Nextcloud instances on Debian

License: GNU General Public License v3.0

Python 92.26% Shell 2.53% Jinja 5.21%

ansible-role-nextcloud's Introduction

Ansible role to install and maintain Nextcloud setups

Build Status Ansible Galaxy

This role is meant to deploy and upgrade Nextcloud instances to Debian systems.

Using the Ansible module nextcloud_app

This role uses the Ansible module nextcloud_app for managing Nextcloud apps. There is a pull request to include the module into Ansible.

How it works

  • The requested Nextcloud version is installed into {{ nextcloud_work_dir }}/nextcloud-{{ nextcloud_version }}.
  • The symlink {{ nextcloud_work_dir }}/nextcloud-current points to the active Nextcloud installation.

Preliminaries

The role takes care of installing and upgrading Nextcloud and its apps. It doesn't install or configure MariaDB/MySQL, mail or web service. The latter has to be done separately.

PHP dependencies required for Nextcloud are installed by that role.

Some modules used in this role are new to Ansible 2.2 and it's tested with Ansible 2.2, 2.3 and 2.4.

The following preliminaries need to be met:

  • Ansible 2.2 or newer
  • Debian target system with the following requirements:
    • MariaDB/MySQL server with admin permissions (may be remote)
    • Webserver (e.g. Apache2/Nginx) with basic PHP support
    • Mail server if Nextcloud instance shall send out mails (may be remote)
    • jmespath library needs to be installed on the host running the playbook (needed for the json_query filter). See requirements.txt
  • The Nextcloud data directory needs to be located outside nextcloud_work_dir

Usage example

  • Integrate the role in your playbook:
- hosts: cloud.example.org
  roles:
    - nextcloud
  tags:
    - nextcloud
  • Configure role variables in host_vars for the target system:
# Nextcloud settings

nextcloud_workdir: "/var/www/cloud.example.org/nextcloud"
nextcloud_data_dir: "/srv/nextcloud/data"
nextcloud_config:
  system:
    memcache.local: '\OC\Memcache\APCu'
    memcache.distributed: '\OC\Memcache\Redis'
    memcache.locking: '\OC\Memcache\Redis'
    redis:
      host: localhost
      port: 6379
    trusted_domains:
      - cloud.example.org
  apps:
    notify_push:
      base_endpoint: "https://cloud.example.org/push"
nextcloud_mysql_password: "******"
nextcloud_admin_password: "******"
nextcloud_notify_push: True

nextcloud_apps:
  - admin_audit
  - calendar
  - contacts
  • Deploy Nextcloud to the target system:

    ansible-playbook site.yml -t nextcloud -l cloud.example.org --diff

  • Configure the VirtualHost in your webserver. The following is an example snippet for a jinja2 Apache2 vhost template:

{% set nextcloud_webroot = nextcloud_workdir|d() + '/nextcloud-current' %}
	DocumentRoot {{ nextcloud_webroot }}
	<Directory {{ nextcloud_webroot }}>
		Options FollowSymlinks
		AllowOverride All

		<IfModule mod_dav.c>
			Dav off
		</IfModule>

		SetEnv HOME {{ nextcloud_webroot }}
		SetEnv HTTP_HOME {{ nextcloud_webroot }}
	</Directory>

    # Proxy rules for the Nextcloud notify_push daemon
    ProxyPass /push/ws ws://127.0.0.1:7867/ws
    ProxyPass /push/ http://127.0.0.1:7867/
    ProxyPassReverse /push/ http://127.0.0.1:7867/

Upgrading Nextcloud

To upgrade a Nextcloud instance, it's sufficient to bump the version in Role variable nextcloud_version and run the role again.

Manually upgrading Nextcloud

If you prefer to upgrade Nextcloud manually, you can configure the role to not perform any uprades by setting nextcloud_upgrade to False. Beware that you also have to set nextcloud_instance to something that doesn't contain nextcloud_version in this case:

nextcloud_upgrade: False
nextcloud_instance: "{{ nextcloud_workdir }}/nextcloud"

Notification push daemon support

When nextcloud_notify_push is enabled, the Nextcloud notify_push daemon will be installed, configured and enabled.

Please beware that further configuration might be needed:

  • Redis needs to be configured for caching.
  • Configure your webserver as reverse proxy. See the upstream documentation for details.
  • Set base_endpoint for the notify_push app accordingly:
    nextcloud_config:
    [...]
      apps:
        notify_push:
          base_endpoint: "https://cloud.example.org/push"
    

Testing & Development

Tests

For developing and testing the role we use Github Actions, Molecule, and Vagrant. On the local environment you can easily test the role with

Run local tests with:

molecule test 

Requires Molecule, Vagrant and python-vagrant to be installed.

License

This Ansible role is licensed under the GNU GPLv3 or later.

Author

https://www.systemli.org

ansible-role-nextcloud's People

Contributors

0x46616c6b avatar dependabot[bot] avatar doobry-systemli avatar nevart avatar sappor0 avatar t2d avatar xshadow avatar zerwes avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.