thorian93.nextcloud
Ansible Role: Nextcloud
This role installs Nextcloud on Debian/Ubuntu, RHEL/CentOS, and Fedora servers.
Known Issues
- Installing on Debian generally works, but you need to set up Nextcloud manually for now. The first run will not complete successfully; this is normal.
Requirements
No special requirements. The role needs root access, so either run it with become: yes
in a playbook or do it as shown below:
- hosts: foobar
roles:
- role: thorian93.nextcloud
become: yes
Role Variables
Here are the available variables with default settings (check defaults/main.yml
):
nextcloud_version
: "20.0.5"
Set the Nextcloud version you want to install.Certificate settings:
nextcloud_create_self_signed_cert
: truenextcloud_self_signed_cert_subj
: "/C=DE/ST=FOO/L=BAR/O=Org/CN={{ nextcloud_external_url }}"nextcloud_self_signed_certificate_key
: "/etc/{{ apache2_http_name }}/ssl/nextcloud.key"nextcloud_self_signed_certificate
: "/etc/{{ apache2_http_name }}/ssl/nextcloud.crt"
Use own custom certificates (if desired):
nextcloud_custom_cert
: falsenextcloud_custom_cert_file
: "/etc/{{ apache2_http_name }}/ssl/nextcloud.crt"nextcloud_custom_cert_key
: "/etc/{{ apache2_http_name }}/ssl/nextcloud.key"
If no self-signed or custom certificates are needed, this will use thorian93.certbot to get certificates.
nextcloud_db_system
: "mysql"
Set up MySQL/MariaDB as the database for Nextcloud.nextcloud_enable_opt_prerequisites
: true
Install optional software that helps Nextcloud work better.TURN server settings for Nextcloud Talk:
nextcloud_turn_enable
: 'false'nextcloud_turn_ip
: "{{ ansible_default_ipv4.address }}"nextcloud_turn_port
: 3478nextcloud_turn_realm
: "{{ nextcloud_external_url }}"- (Set
nextcloud_turn_secret
in your inventory when ready.)
Backups:
nextcloud_backup
: falsenextcloud_backup_path
: "/tmp"
Directory settings:
nextcloud_web_dir
: "/var/www/nextcloud"nextcloud_data_dir
: "/var/www/nextcloud/data"
It's best to keep the data directory outside the web root.
PHP options for Nextcloud:
nextcloud_php_options: - line: "post_max_size = 4G" regexp: "^post_max_size =" - line: "upload_max_filesize = 4G" regexp: "^upload_max_filesize =" - line: "open_basedir ='{{ nextcloud_web_dir }}:{{ nextcloud_data_dir }}:/tmp:/dev/urandom'" regexp: "^open_basedir ="
List the apps to enable:
nextcloud_enabled_apps
:- files
Dependencies
- thorian93.apache2
- thorian93.php
- thorian93.certbot - when not using a custom or self-signed certificate
- thorian93.mysql
OS Compatibility
This role checks if it's used on supported operating systems by verifying if the correct distribution name and major version number are present in the variable called <role-name>_stable_os
. You can find this variable in defaults/main.yml
:
role_stable_os:
- Debian 10
- Ubuntu 18
- CentOS 7
- Fedora 30
If there is a version mismatch, the role will fail. You can add the new distribution and version to this variable, but make sure to test it first!
Thanks to HarryHarcourt for this idea!
Example Playbook
---
- name: "Run role."
hosts: all
become: yes
roles:
- ansible-role-nextcloud
Contributing
Feel free to report any bugs, issues, or suggestions for improvement. You can also contact me anytime for questions or discussions.
Disclaimer
This role is provided AS IS. I cannot guarantee that it will work correctly or be responsible for any damages or misconfigurations caused by using it. Review the role thoroughly before using.
License
MIT
Author Information
This role was created in 2020 by Thorian93.
Nextcloud - Open Source Files and Collaboration
ansible-galaxy install thorian93.nextcloud