One of my old hosting setups is showing its age and becoming awkward to maintain. I have migrated as much as I could into my WPengine account, but a few websites still need to be migrated and I plan on hosting them with Docker containers. Ansible automation all the way.
Why Tracking Website Content in git is Cool With website hosting, there’s always some trickery involved in maintaining content. You should consider yourself lucky if you are doing it with source control solution like git – it really helps not only do things in an orderly manner but also scale them to larger team supporting website.
Even if you believe you’ll “just install this once” and then “mostly focus on content”, blogging software would have to be maintained – meaning there will be upgrade times and there will be rollback times. So source control is key to going through such transitions smoothly enough.
I decided to store these old websites in GitHub: it’s a convenient approach I’m increasingly reliant on, it scales well and it gives me versioned control of everything. But this time it’s also giving me a distribution method: instead of downloading code onto my laptop and then somehow transferring latest copy to the server, I can just checkout GitHub repo onto the server directly.
Ansible has a great little module for doing this: git module. It provides much more flexibility that I need right now, all in an intrinsically Ansible easy-to-read way.
Here are the parameters and how they work in this example:
Previous example is very easy to convert into a multi-repo arrangement.
First, I define a number of hosts as Ansible variables, like this:
name: Deploy website code from GitHub repositories git: repo: “” version: master dest: /storage/docker/www/ accept_hostkey: yes force: yes with_items:
Thanks for stopping by and chat later!