CI/CD with Ansible Tower and GitHub

Every so often I come across an interesting use-case or a really creative way to integrate different technology that I haven’t seen before. I follow a few folks on social media and blogs that do this stuff on a regular basis, one of them being Keith Tenzer. He’s put together a really interesting demo of Ansible Tower connected with GitHub and a webhook that showcases how CI/CD can be accomplished using Ansible without the need for a formal CI/CD pipeline toolset like Jenkins. He sparked an idea for me to put together a similar environment as I think this makes for a great demo and showcase of what Ansible Tower is capable of.

I’ve adapted his work to use Azure instead of OpenStack, but the concepts remain the same. He’s got some detail in his blog about how to setup the environment and connect services together, so I’ll let his work there speak for itself on how to get it setup. The changes I’ve made can be found in a couple of playbooks that provision infrastructure in Azure:

Then I use a webservice called ultrahook.com to bridge the GitHub events to my homelab of Ansible Tower. You may not need this if your Ansible Tower server lives in the cloud. The high level architecture and workflow looks like this:

Lastly, I’ve recorded a demo of what this looks like. Similar to Keith, showcasing the developer workflow of checking in code, Tower building infrastructure and running the unit testing, then finally updating GitHub with the result. Then highlighting what a maintainer might see when they’re doing to merge the new code into the project.