Skip to content

Why we use Ansible to build Rails SaaS servers in minutes

Two hosting options

When you own a SaaS business you have practically two hosting options to choose from. IaaS or PaaS. IaaS is cheaper and gives you more control but it comes with more risk and responsibility to handle. PaaS is quite expensive and gives you less control and handle some risk and responsibility for you. We use the IaaS model because our infra contains several apps and we like to have full control over our environment. Additionally, this options is a lot cheaper in our case.

Our story

In the beginning, we built our infrastructure from scratch and by hand. We need around 6 hours to finish this process. Our next move was to write some scripts and checklists to have step by step guide for building our servers. With this help, we could set up our machines in 3 hours.

Lately, we decided to move our software to other hosting company. To choose the next IaaS environment we have to run some performance tests for new machines. The setup time has become a blocker here. 3 hours for the single machine was too long for fast and efficient testing procedure.


We decided to use Ansible to automate our building process. With this tool, we could set up a new server in 15 minutes or less. We could test several hosting options within a single day instead of wasting the time for building infrastructure by hand.

Finally, we moved our infrastructure to the new hosting company practically in no time. More time was needed for planning and preparing maintenance window than the migration process itself. There is a bonus here. We now have a disaster recovery plan and we know that we could rebuild our infrastructure from scratch in minutes.


It takes some time to master Ansible and polish your playbooks but it is worth the time spend on that. Of course, there are a lot of Ansible examples for different application types, but we encourage you to build your playbooks from scratch. You will learn useful knowledge and have full control over your infrastructure code.

If you have no time to master Ansible or you have the simpler infrastructure you could use a tool called Dokku. Paweł Urbanek wrote great step by step tutorial about migration from Heroku (PaaS) to your own IaaS with Dokku.


Image courtesy of the CSIRO,