I'm guessing, but why does this module use local_action, instead of delegate_to: localhost? Maybe something in ansible is doing a double encode/decode with the complex nested data when local_action is in use.

On 02/05/2014 08:19 AM, Amir Hajizamani wrote:
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.

You aren't reading that right. He tried it twice, once with "", and once without. The time he tried it without, yaml was complaining about the {{. Count the leading spaces, and you'll get to column 24. At a guess, you are looking at some broken html rendering of the email, which is using a proportional font. When I went to reply to this, the error caret lined up correctly.

His real problem is when he tried it with "", and is shown in the ansible-doc output.

    On Fri, Oct 18, 2013 at 8:38 AM, Marc Peiser <ma...@cloudafrica.net
    <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 ansible-proje...@googlegroups.com
        <javascript:>.
        For more options, visit https://groups.google.com/groups/opt_out
        <https://groups.google.com/groups/opt_out>.




    --
    Michael DeHaan <mic...@ansibleworks.com <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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to