Ansible vs Terraform vs CloudFormation

Studying for my AWS professional certifications introduced me to the wonderfully difficult to read world of JSON and CloudFormation templates. Once I discovered you can write them in YAML they became a bit less intimidating, and on the whole pretty amazing. CF templates were my first introduction to Infrastructure as Code, and it has been a lot of fun trying auto reproduce my school’s infrastructure in another region using them. I also had a chance to work with them on my log aggregation project, and wrote a template to install my log transport function, which was pretty cool.

I picked up Terraform as I was applying for a job which had it as a requirement, and I found it easier to pierce than CF templates, mainly because the syntax and variables were easier to read than straight JSON ( I didn’t know about YAML CF templates till later), and I could comment the terraform templates easily, where you can’t comment a JSON file. So, most of my IoC scripts are in Terraform.

I just started working with ansible to solve a server deployment issue at my school where I am deploying a container cluster. I seized on ansible to manage the configurations, and it made deploying the 5 servers a snap.

What I didn’t realize at the time is that ansible can be used for so much more than configuration management. To paraphrase an old Steve Martin joke, it’s like ansible has a module for everything! I had a friend, who uses ansible in production, take a look at my first playbook, and he showed me that instead of treating it like a glorified init script, ansible could create resources and deploy containers as easy as terraform and cloudformation.

Mind blown!

So, my challenge is to create all of my IoC code in each flavor (ansible, terraform and cloudformation) and build automation pipelines for each. As I get them built and tested, I’ll post anonymized versions here. What an adventure!

Leave a Reply

Your email address will not be published. Required fields are marked *