First, I would like to announce the ownCloud Ansible GitHub organisation:
A huge thank you goes out to Robert who developed all roles and custom modules to make this work.
There you can find Ansible roles to set up ownCloud on CentOS 7 and Ubuntu 18.04.
CentOS 8 still need some adjustments to the package installation in the playbooks in order to work.
The roles are being automatically tested, however if you find errors please report them in the respective issue trackers.
There is some documentation available on https://owncloud-ansible.github.io/
Try it out, feedback welcome!
And now I would like to dive straight into a quick how to:
The easiest and fastest way to get a working single instance setup on CentOS is with the help of the playground repo:
- Linux workstation
- Ansible installed
- git installed on the Linux workstation
- SSH access from the Linux workstation to the server you want to install ownCloud on
- An administrative user on that server, either root or a user that doesn’t need a password to run commands with sudo:
<username> ALL=(ALL) NOPASSWD: ALL
- The ownCloud-server-to-be needs internet access (see footnote)
- If your server is CentOS the following packages need to be installed beforehand: centos-release-scl, gcc (to get an up to date PHP version and be able to compile additionally required PHP modules)
- Clone the following repo: https://github.com/owncloud-ansible/playground
cdinto the directory where you cloned the repo to
ansible-galaxy install -r roles/requirements.yml --forceto download the additional roles. By default these will be installed in
- Delete the example inventories you don’t need. For example the
inventoriesfolder, if you’re going to install on CentOS
- Adjust the
hostsfile in the
centosinventory like so:
[database] db1 ansible_host=<ip.add.re.ss of your server> [redis] redis1 ansible_host=<ip.add.re.ss of your server> [owncloud] owncloud1 ansible_host=<ip.add.re.ss of your server> [all:vars] ansible_user=<admin user> # add the two following lines if your not using root to log in ansible_become=yes ansible_become_user=root
For a single instance setup you can also put the variable
ansible_host into the
all:vars section. For a more in depth explanation of this please see at the bottom of this post.
--- # For security reasons you should set a strong password # for the owncloud DB and root user! mariadb_root_password: <set a secure MySQL root pw> mariadb_users: - name: owncloud host: localhost password: <set a secure owncloud db pw> priv: "owncloud.*:ALL" ...
Here you can overwrite any of the defaults set in
inventories/centos7/group_vars/owncloud.yml, a minimal configuration could look like:
owncloud_version: "10.4" owncloud_fqdn: <your.owncloud.fqdn.tld> owncloud_admin_password: <set a secure pw> owncloud_db_password: <set the pw from the file above> apache_vhosts: - servername: "<your.owncloud.fqdn.tld>" documentroot: "/var/www/owncloud"
You will probably want to define an SSL site here as well, check the apache ansible role defaults for details
In this file you can overwrite any of the defaults defined for the roles in
For point 7 and 8 you need to understand Ansible inventories, have a look in their documentation for more information: https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html
- Finally run
ansible-playbook -i inventories/centos7/hosts playbooks/setup.ymland watch it install ownCloud
There are ways to automatically install ownCloud apps, set various ownCloud settings, make it a multi-instance setup, … The possibilities are endless
But just a few default settings you need to know:
- ownCloud admin user is
- Ansible creates a
- The data folder is set up to be in
- The config folder is in
- The writeable apps folder is
- The previous three folders are symlinked from the main ownCloud installation folder
Explanation to the internet access of the ownCloud server: The ansible-playbook will download and install various packages from the repositories, download the ownCloud tarball and connect to the marketplace for additional apps. If your server is on an intranet without access to the public internet, you can also configure your server to use your own repository mirrors. Additionally you can also provide the ownCloud tarball from your local Ansible host filesystem. For marketplace apps you can provide an alternative download URL.
Explanation for the hosts file - 6:
- This is mapping the different ansible roles to individual hosts. This allows also a rapid multi-instance setup, when defining different hosts for each role. However various other variables in the playbooks also need to be adjusted for the multi-instance setup to work through ansible.
- A new trick that I like to use to install everything locally, is to not define where any of the hosts are at all and just put
[all:vars]section. This will, instead of try to use SSH just install everything locally.