you have *var="{{ ec_asg_info.instances }}"*
*and in with_items: ec2_asg_info shouldnt it be : e**c_asg_info*
On Tue, Jun 9, 2015 at 9:08 AM, Igor Cicimov <[email protected]
> wrote:
> Hi all,
>
> I'm creating an ASG in my playbook from which I launch the following
> instances:
>
> TASK: [create auto scaling group]
> *********************************************
> changed: [localhost]
>
> TASK: [debug *var="{{ ec_asg_info.instances }}"]*
> *******************************
> ok: [localhost] => {
> "var": {
> "['i-9abfff30', 'i-ee4ea517', 'i-08ec48a2']": "['i-9abfff30',
> 'i-ee4ea517', 'i-08ec48a2']"
> }
> }
>
> TASK: [debug var="{{ item }}"]
> ************************************************
> ok: [localhost] => (item=i-9abfff30) => {
> "item": "i-9abfff30",
> "var": {
> "i-9abfff30": "i-9abfff30"
> }
> }
> ok: [localhost] => (item=i-ee4ea517) => {
> "item": "i-ee4ea517",
> "var": {
> "i-ee4ea517": "i-ee4ea517"
> }
> }
> ok: [localhost] => (item=i-08ec48a2) => {
> "item": "i-08ec48a2",
> "var": {
> "i-08ec48a2": "i-08ec48a2"
> }
> }
>
> and then I pass the list of the create instances to the ec2_eip task:
>
> - name: associate new elastic IPs with each of the instances
> ec2_eip:
> instance_id={{ item }}
> region={{ vpc_region }}
> in_vpc=yes
> with_items: *ec2_asg_info.instances*
> register: eip_info
>
> which fails with the following error:
>
> TASK: [associate new elastic IPs with each of the instances]
> ******************
> failed: [localhost] => (item=ec2_asg_info.instances) => {"failed": true,
> *"item":
> "ec2_asg_info.instances"*}
> msg: EC2ResponseError: 400 Bad Request
> <?xml version="1.0" encoding="UTF-8"?>
> <Response><Errors><Error><Code>InvalidInstanceID.Malformed</Code><Message>*Invalid
> id: "ec2_asg_info.instances*
> "</Message></Error></Errors><RequestID>9c204182-d5b6-41e0-badb-c6e85a9bc8e5</RequestID></Response>
>
> FATAL: all hosts have already failed -- aborting
>
> Note the invalid ID message coming back which has the list name instead of
> the item set.
>
> Which is strange since if I run another playbook with the ec2_eip module
> only in which I set the list manually (after I created the instances with
> the previous asg playbook of course):
>
> - name: associate new elastic IPs with each of the instances:
> ec2_eip:
> instance_id={{ item }}
> region={{ vpc_region }}
> in_vpc=yes
> *with_items: "['i-9abfff30', 'i-ee4ea517', 'i-08ec48a2']"*
> register: eip_info
>
> the tasks executes fine:
>
> TASK: [associate new elastic IPs with each of the instances]
> ******************
> changed: [localhost] => (item=i-9abfff30)
> changed: [localhost] => (item=i-ee4ea517)
> changed: [localhost] => (item=i-08ec48a2)
>
> What is going on here?
>
> Thanks,
> Igor
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/96f3764c-00e8-47b2-bf11-3ccbdc7936e0%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/96f3764c-00e8-47b2-bf11-3ccbdc7936e0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAFUV_d4rSSZMpAkxdgH54bzQBLcOitaCodsN6JuB%2BagR6qgOAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.