Skip to content

Instantly share code, notes, and snippets.

@base10
Last active December 23, 2015 09:29
Show Gist options
  • Save base10/6614848 to your computer and use it in GitHub Desktop.
Save base10/6614848 to your computer and use it in GitHub Desktop.
Troubleshooting amazon termination
GATHERING FACTS ***************************************************************
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1379534403.68-80673291747765 && chmod a+rx $HOME/.ansible/tmp/ansible-1379534403.68-80673291747765 && echo $HOME/.ansible/tmp/ansible-1379534403.68-80673291747765']
<localhost> REMOTE_MODULE setup
<localhost> PUT /var/folders/4k/1wyf_lds3dvfy66qd11ys5m40000gp/T/tmplpcQKN TO /Users/nathan/.ansible/tmp/ansible-1379534403.68-80673291747765/setup
<localhost> EXEC ['/bin/sh', '-c', '/usr/local/bin/python /Users/nathan/.ansible/tmp/ansible-1379534403.68-80673291747765/setup; rm -rf /Users/nathan/.ansible/tmp/ansible-1379534403.68-80673291747765/ >/dev/null 2>&1']
ok: [localhost]
TASK: [show ec2 instances] ****************************************************
ok: [localhost] => {"item": "", "msg": "Instance Ids are [u'i-e0d0f889']"}
TASK: [shutdown aws instances] ************************************************
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-1379534403.89-185516168856904 && chmod a+rx $HOME/.ansible/tmp/ansible-1379534403.89-185516168856904 && echo $HOME/.ansible/tmp/ansible-1379534403.89-185516168856904']
<127.0.0.1> REMOTE_MODULE ec2 region=us-east-1 state='absent' instance_ids=[u'i-e0d0f889']
<127.0.0.1> PUT /var/folders/4k/1wyf_lds3dvfy66qd11ys5m40000gp/T/tmp4rBo6a TO /Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ec2
<127.0.0.1> EXEC ['/bin/sh', '-c', '/usr/local/bin/python /Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ec2; rm -rf /Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ >/dev/null 2>&1']
failed: [localhost] => {"failed": true, "item": "", "parsed": false}
invalid output was: Traceback (most recent call last):
File "/Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ec2", line 1555, in <module>
main()
File "/Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ec2", line 604, in main
(changed, instance_dict_array, new_instance_ids) = terminate_instances(module, ec2, instance_ids)
File "/Users/nathan/.ansible/tmp/ansible-1379534403.89-185516168856904/ec2", line 510, in terminate_instances
for res in ec2.get_all_instances(instance_ids):
File "/usr/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 530, in get_all_instances
filters=filters, dry_run=dry_run)
File "/usr/local/lib/python2.7/site-packages/boto/ec2/connection.py", line 600, in get_all_reservations
[('item', Reservation)], verb='POST')
File "/usr/local/lib/python2.7/site-packages/boto/connection.py", line 1082, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidInstanceID.Malformed</Code><Message>Invalid id: "[ui-e0d0f889]"</Message></Error></Errors><RequestID>fc6ef435-6b77-4b69-915f-476d9fb9785b</RequestID></Response>
FATAL: all hosts have already failed -- aborting
{'InstanceId.1': u'i-b3b502d1'}
- name: show ec2 instances
local_action:
module: debug
msg="Instance Ids are {{ec2.instance_ids}}"
- name: shutdown aws instances
local_action:
module: ec2
region={{region}}
state='absent'
instance_ids=ec2.instance_ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment