Ansible playbook to create nextcloud server

Hi there, I’m Si Walker, an Onboarding engineer with a Linux background at CenturyLink Cloud. As part of my role I figured owncloud out and we deployed a server for a customer of ours. I’ve since seen that the development of nextcloud looks to be making better strides so I’ve adapted and improved an Ansible Playbook and I thought some folks might be interested in seeing it.

CenturyLink have a product called Runner that basically executes Ansible plays so there are some slight differences from running Ansible locally, like there is no hosts file because the first thing that happens is it creates the server then adds the group that the server belongs to into an inventory list. That said, it could easily be adapted to run locally or from a dedicated Ansible control server.

Any feedback would be welcome and if anyone would like to see the full play being executed I could try and get it recorded and host it on my nextcloud server :slight_smile:

Si

3 Likes

In my rush to leave work today I forgot to explain that this play uses the manual installation on an Ubuntu 14.04 server, installs and hardens MySQL and creates the nextcloud database, installs and configures apache and postfix, installs some php packages and the redis memcache thing, makes some directory structures, sets some permissions & ownership and copy’s some config files to the server.

It should leave you with a server that is ready to be hit at http://aa.bb.cc.dd/nextcloud to input your admin details and database password at which point you can go and configure a few things in the config.php before you shut off port 80. Further details are in the readme on github

Hello
Thank you Arrold for sharing it.
Can I use some parts to add to mine ?
I’m doing an ansible role for an all in one host nextcloud server (with some choices of db backend, http server and TLS) and i’m interressed by the apache conf part.
Regards.
Aal.

Hi, You’re welcome, glad it’s helped out. Feel free to use whatever you want, isn’t that what github’s for?
Si

Oh, and I’d be interested to see what your Ansible looks like, especially if there are differences from mine.

Hi Arrold
I took a very different way when doing the role
you can find it here :


still missing major features such as apache installation (only nginx) and letsencrypt/cerbot certificat generation.
this should improve over the next week.
Regards.
Aal

1 Like

Hi there.
I have made many improvments to the role since last post.
I’ve also added:

  • Apache2 installation support
  • PostgreSQL installation support

For now it works on thoses systems

  • ubuntu 14.04
  • ubuntu 16.04
  • debian 8.5

However I feel it’s still not ready for release in ansible galaxy.

I would like to know if some ansiblers would want to test the hell out of it and report/make suggestions
The github repo again:


Thanks, :slight_smile:
Aal.

1 Like

Hi there, :
The role has been released in Ansible Galaxy :smile:
https://galaxy.ansible.com/aalaesar/install_nextcloud/

Any feedback, suggestion or contribution is apreciated :slight_smile:
Regards, Aal.

2 Likes

Aalaesar,

Thank you so much for assembling the Ansible install script. I was wondering if someone could give a brief description how to use it. I installed Ansible and went through the tutorial but I don’t understand how to use the Role rather than a Playbook.

Thanks,
Wayne

Hello Wayne,
Sorry I just saw your post today :frowning:
I have been working on this role and have added more options and post-install process. (see the lastest release)

Maybe you have figured it out by now, In Ansible, a role have to be called from a playbook,

Of course you may want to define some variables for the role in order to customize your installation.
You may define the variables in a playbook or even in the inventory files. There is a lot of options…

You’ll find most of the role’s documentation in the readme file with some playbook examples at the end or even in the tests folder.

I hope you get what you want :wink:
Regards, Aal.

thank you!

Hi, just wanted to add that I wrote and published my own Ansible role to install, configure and upgrade Nextcloud instances. It doesn’t take care of MariaDB/MySQL or Apache2/Nginx as I believe that this is better done by separate roles. But my role supports configuration of Nextcloud Apps to be installed and has routines to upgrade Nextcloud to a newer release. For further information, see the README.md.

I also wrote and published an Ansible role to install and update Spreed WebRTC, which is needed for the Spreed.ME App.

I hope that it is of help for those who aim to maintain their Nextcloud and Spreed.ME instances with Ansible.

Hi there I’m clearly also a sucker for reinventing the wheel as I have written Ansible playbooks to install Nextcloud on Debian 9 (Stretch) and also a playbook to install and setup Docker / CODE before looking at anyone else’s playbooks, linked above, next time I have some spare time to update our ones I’ll look with interest to see how you have all approached this :slight_smile: