We've been on-boarding more Technical Consultants lately and we've been improving how we introduce them to our technology stack. We had a need to have a learning environment for two technologies:
- Ansible - used on more and more of our technical engagements. We use this to deploy the Atlassian applications and more.
- Click2Clone - we deploy this on many customer engagements as both a migration utility and to restore data from production applications to lower tiers
We wanted new people to be able to test both of these tools end-to-end in an environment that had enough resources to provide "real world experience". This seemed easy enough at first. I thought we'll just spin up instances in AWS and hand over the keys. But there was a need to isolate this learning environment from everything else we are doing. We also wanted to add some extra challenges that needed to be figured out along the way. With new requirements I decided we needed something more repeatable that would also minimize the amount of time the facilitator had to take away from customer work in order to stand up.
Using an Ansible playbook and CloudFormation I was able to automate everything from the EC2 Key Pair creation, standing up of a VPC with both public and private subnets, then standing up three EC2 Instances (Jira Prod, Jira Dev and a Click2Clone instance) and two PostgreSQL RDS instances. Lets break this down:
This section tells Ansible to execute the playbook locally (since we don't yet have any remote instances.
- hosts: "localhost"
This section is the meat and potatoes of this automation. It does the following:
- Creates the AWS Key Pair and then creates the corresponding local pem file.
- Executes a CloudFormation template that creates a VPC, four subnets and the other related AWS pieces. Here is an example: https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/VPC/VPC_With_Managed_NAT_And_Private_Subnet.yaml
- Executes a CloudFormation template which spins up three EC2 nodes, two RDS nodes, a handful of security groups, Load balancers and Route 53 entries for each load balancer.
- name: Check if AWS Key Pair Private Key exists
- name: Create AWS Key Pair
when: aws_key_exists.stat.exists == False
- name: Create VPC for Exercise via CloudFormation
- name: Create Infrastructure for Exercise via CloudFormation
After spinning up all the necessary infrastructure I wondered what to do with all the details. Much of it was set as Outputs from the CloudFormation templates, but how do I easily and securely get that information to the new Technical Consultant?
Check out Jaime's blog post on how we got the infrastructure details along with the pem file into Confluence so that we could give the candidate a single link.