Building HA Clusters with Ansible and Openstack

VPS case studies

This article is an extensive guide on building high available clusters with Ansible and Openstack. It is written by CloudVPS cloud admin Remy van Elst and was published last week on his personal blog

We'll build a Highly available cluster consisting out of two load balancers, two database servers and two application servers. This is all done with Ansible, the cluster nodes are all on Openstack. Ansible is a super awesome orchestration tool and Openstack is a big buzzword filled software suite for datacenter virtualization.


This image represents the setup we will create. It will be a simple, data center redundant high available cluster. The tutorial sets up two nginx frontend load balancers with keepalived failover, two mysql database servers with master-master replication and keepalived failover and two application servers with apache and php plus glusterfs for file syncronization.

We'll create and provision these VM's fully with Ansible combined with the magic of Openstack.

Openstack has the concept of Availability Zones. Your can see this as multiple, physically independent networks which are logically able to communicate. Most Cloud providers call them seperate Data centers or Regions. If your Cloud provider has set it up correctly, the Openstack Cloud, and thus your cluster, will survive one full datacenter failing.

This tutorial sets up Wordpress as the application, but it can be easily adapted for any other cluster setup.

I'm using the Openstack Cloud from CloudVPS, but any Openstack cloud will do. CloudVPS is the best one though, in my opinion. The screenshots you'll see are not of the default Openstack dashboard but of the CloudVPS Skyline Openstack Interface.

This playbook and tutorial are easily adaptable for another cloud provider. I however prever the openness of Openstack, if one Openstack provider throws the towel, my "cloud" applications will be redeployed in another Openstack Cloud without issues. Providers like Digital Ocean do not provide that benefit.

The playbook can be found in this git repository.

I like Ansible, I've written some more articles about it. I'm also a fan of Openstack, check out my other articles about it.. Last but not least I also like Ubuntu.