ansible/ansible — pull request #5988 by willthames (2014-02-13 09:57:40+00:00)
Title: ec2 module fails when state is not absent

##### Issue Type:

Bugfix Pull Request

##### Ansible Version:

ansible 1.5 (devel 6f405c8970) last updated 2014/02/13 18:12:39 (GMT +1000)

##### Environment:

N/A

##### Summary:

tagged_instances is initialised in a scope not visible
when state is not absent.

##### Steps To Reproduce:

run ec2 module against an instance with state=absent

##### Expected Results:

instance should be terminated

##### Actual Results:

```
[will@cheetah ansible]$ ansible-playbook -i ~/src/ansible/plugins/inventory/ec2.py ec2_destroy.yml

PLAY [tag_Name_newbobbins] ****************************************************

TASK: [ec2 ] ******************************************************************
failed: [54.206.23.206] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/Users/will/.ansible/tmp/ansible-tmp-1392285420.29-67669935799855/ec2", line 2210, in
main()
File "/Users/will/.ansible/tmp/ansible-tmp-1392285420.29-67669935799855/ec2", line 1073, in main
module.exit_json(changed=changed, instance_ids=new_instance_ids, instances=instance_dict_array, tagged_instances=tagged_instances)
UnboundLocalError: local variable 'tagged_instances' referenced before assignment
```