Since working with @alex on a job for Outlandish around a year and a half ago, which involved him showing me how to use Ansible, I have been using it for almost all the server configuration work that we have, a lot of the code I have written is publicly available on git.coop.
Up until recently I have been using one git repo per server type, for example see the Nextcloud, Mailcow or Discourse repos.
I’m now looking at re-organising everything to use Ansible Galaxy, however rather than using existing Galaxy roles (I’d rather write my own) or uploading repos to GitHub (if I can find a easy way to mirror repos to GitHub I might do that), I’m going to use the ansible-galaxy
command to pull roles into a repo that contains a hosts.yml
file for managing all our servers.
The first repo that contains a single role that I have created from scratch is the Matomo one, this is used for upgrading all our Matomo servers, there isn’t much code in it but it illustrates the single role per repo model and the REAME documents how to use it and the format of the hosts.yml
file.
Another example is the Docker repo, this was originally designed to be use as a stand-alone repo for installing Docker and Docker Compose but it has now been refactored to be used by ansible-galaxy
and in addition, thanks to a few symlinks, it can still be used in a stand-alone role, which is handy for doing things like using it to install Docker locally.
The more complicated repos, like the Nextcloud one, will take some time to reorganise (see this issue), but I now have a very good reason to get this done — Chris from the Commons Cloud project has been using this repo (with some amendments) and following a very positive Nextcloud Talk video chat with him yesterday we have agreed to work on the code together.
I’m planning to document everything in the respective git repos but thought it would be worth creating a thread here for discussing the broad approach with the other Ansible users with accounts here.