Configuring AWS EC2 instance after it's created through Ansible

Hi there

I’ve got a play that creates an AWS EC2 instance through a CloudFormation template. After it’s created I would like to configure it - I can use the AWS tools to do that but I prefer to use Ansible to be consistent with our other deployments.

What I have now is:

`

You can use the returned data from cloudformation to call add_host, then start a new play that targets that host, or set up an EC2 dynamic inventory script that will pick up the host(s) you’re creating and conditionally call meta: inventory_refresh when you know an instance got created (then do the same thing: start another play that touches the right host(s)). I personally prefer the add_host approach as it’s more definitive that you’re touching exactly the right host, but potato, potahto…

-Matt