ansible/ansible — pull request #7827 by willthames (2014-06-19 03:31:40+00:00)
Title: ec2 module: Delay instance tagging to later in the instance creation process

##### Issue Type:

Bugfix Pull Request

##### Ansible Version:

ansible 1.7 (devel aac194e639) last updated 2014/06/19 11:13:25 (GMT +1000)

##### Environment:

N/A

##### Summary:
When creating instances with tags using the ec2 module, the tagging bit can result in
InvalidInstanceID.NotFound errors.

By delaying the tagging until the last part of instance creation, we should be typically more fortunate (handling all such race conditions might need more work such as retry with backoffs)

##### Steps To Reproduce:

This appears to be sporadic but has been reported elsewhere
http://blog.picloud.com/2013/02/17/dealing-with-the-inconsistent-ec2-api/

Until today we'd never hit it (or at least not enough to concern us) but today all instance creation has been failing.

Essentially create an ec2 instance with the ec2 module using the tags argument. However, a successful instance creation just suggests that the timing glitch was avoided.

##### Expected Results:

Instance gets created and tagged appropriately

##### Actual Results:
failed: [instance123] => {"failed": true}
msg: Instance tagging failed => InvalidInstanceID.NotFound: The instance ID 'i-abcd1234' does not exist