Hi Michael,

Thanks for this, I also tripped up on this issue. I was about to prep and 
send a pull-request to update the docs for this, but wondered if there's 
any point if this issue will be ironed out by the next release anyway?

A

On Friday, 18 October 2013 14:33:46 UTC+1, Michael DeHaan wrote:
>
> it says you have a YAML syntax error, so this is not an Ansible thing per 
> se.
>
> If you need to pass a reference you must still do it like this, and this 
> is the only reason to ever do this.
>
> instance_ids: ${some_list}
>
> This will be going away in a future release once I bang on things a bit.
>
> As for the YAML Syntax error, there's some code to provide suggestions in 
> 1.4, but it seems it was thrown off by the underscore.  Curious.
>
>
>
>
> On Fri, Oct 18, 2013 at 8:38 AM, Marc Peiser 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> I'm trying to terminate an ec2 instance but I'm getting the following 
>> error:
>>
>> PLAY [Terminate instance] 
>> *****************************************************
>>
>> GATHERING FACTS 
>> ***************************************************************
>> ok: [127.0.0.1]
>>
>> TASK: [Terminate instances that were previously launched] 
>> *********************
>> failed: [127.0.0.1] => {"failed": true, "parsed": false}
>> invalid output was: Traceback (most recent call last):
>>   File 
>> "/home/smartallocator/.ansible/tmp/ansible-1382099110.85-99795266100410/ec2",
>>  
>> line 1587, in <module>
>>     main()
>>   File 
>> "/home/smartallocator/.ansible/tmp/ansible-1382099110.85-99795266100410/ec2",
>>  
>> line 637, in main
>>     (changed, instance_dict_array, new_instance_ids) = 
>> terminate_instances(module, ec2, instance_ids)
>>   File 
>> "/home/smartallocator/.ansible/tmp/ansible-1382099110.85-99795266100410/ec2",
>>  
>> line 543, in terminate_instances
>>     for res in ec2.get_all_instances(instance_ids):
>>   File "/usr/local/lib/python2.7/dist-packages/boto/ec2/connection.py", 
>> line 539, in get_all_instances
>>     filters=filters, dry_run=dry_run)
>>   File "/usr/local/lib/python2.7/dist-packages/boto/ec2/connection.py", 
>> line 609, in get_all_reservations
>>     [('item', Reservation)], verb='POST')
>>   File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 
>> 1117, 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: 
>> "[u'i-29333566']"</Message></Error></Errors><RequestID>129f061b-da3e-4fa5-be80-9ad6493678f8</RequestID></Response>
>>
>>
>> FATAL: all hosts have already failed -- aborting
>>
>> My play looks as follows:
>>
>> - name: Terminate instance
>>   hosts: localhost
>>   connection: local
>>   tasks:
>>     - name: Terminate instances that were previously launched
>>       local_action:
>>         module: ec2
>>         state: 'absent'
>>         instance_ids: "{{ ec2.instance_ids }}"
>>         region: eu-west-1
>>
>> The example in the docs does not have quotes around the {{ 
>> ec2.instance_ids }} variable but if I omit the quotes then that errors too:
>>
>> ERROR: Syntax Error while loading YAML script, site.yml
>> Note: The error may actually appear before this position: line 41, column 
>> 24
>>
>>         state: 'absent'
>>         instance_ids: {{ ec2.instance_ids }}
>>                        ^
>>
>> Any ideas? I'm running ansible 1.4 from source.
>>
>> Thanks,
>> Marc
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> Michael DeHaan <[email protected] <javascript:>>
> CTO, AnsibleWorks, Inc.
> http://www.ansibleworks.com/
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to