New deployment

If we are working on a new deployment, then we need to perform the following tasks:

  1. Find the latest CentOS 7 AMI in the region we are using
  2. Upload a copy of our public key so that we can use it to SSH into the instance
  3. Launch an instance using the previous information
  4. Add the new instance to a host group
  5. Wait until SSH is available
  6. Add our instance to the Elastic Load Balancer

All of these tasks are defined in roles/ec2/tasks/new_deployment.yml, so let's start working on these tasks by looking at how we can find the correct AMI to use.

We can't simply supply an AMI ID here as each region has a different ID, and also each AMI is regularly updated to make sure it is patched. To get around this, we can run the following tasks: ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.