Ansible and Terraform for configuration management on AWS
Submitted by Ambar Seksena on Sunday, 5 November 2017
This workshop will get you acquainted with Ansible: a powerful, popular CM (Configuration Management) framework and Terraform: Hashicorp’s popular infrastructure-as-code tool. These are mostly cloud-agnostic tools but we will be focusing on AWS for this workshop.
We will kick-start with a short demo: we’ll use Ansible’s agent-less server orchestration capabilities to solve a common DevOps problem. We’ll then learn some ad-hoc Ansible commands that deliver immediate utility with almost no learning curve. Next, we’ll write a basic Ansible playbook that accomplishes something relatively small but significant. We’ll move on to more advanced Ansible topics as time permits: roles, vars, handlers, templates, tags, managing dynamic cloud inventory (e.g. in an ASG), using Ansible-Vault and Ansible-Galaxy. If there’s time, we’ll show you how to write your own Ansible module.
We’ll next move onto Terraform, starting with the basics again - the “dev loop” of init, plan, apply, destroy. We’ll run through the same basic single-VM example using Terraform HCL. We’ll take about tfstate files and how to manage state, how to externalize config.
We’ll show a quick demo of bringing up an entire environment consisting of possibly multiple stacks with Terraform and then configuring it with Ansible.
Ansible vs Terraform vs CloudFormation vs …
Some typical use-cases for these tools, which tool to use when
Tips on debugging Ansible and Terraform
Some best practices and gotchas when using these tools
No prior knowledge of either Ansible or Terraform is required, as we will start from scratch. Some familiarity with AWS (or any other cloud) will be helpful.
Laptops are required as the instruction will mostly be hands-on.
Python 2.7+ (or 3.x) must be installed beforehand.
Please install Ansible (preferably using
pip install ansible)
Please install Terraform (https://www.terraform.io/intro/getting-started/install.html)
Ambar: Principal Engineer at CloudCover. Whether making code or breaking code, he loves to “automate ALL the things!”
Akshay: Software Dev and Top Nerd at CloudCover.
Deepak: DevOps Maverick at CloudCover with oodles of Ansible, Terraform and SRE experience.