# Weird issue with ec2\_eip module

**URL:** <https://forum.ansible.com/t/weird-issue-with-ec2-eip-module/18443>\
**Category:** Ansible Project\
**Created:** [June 9, 2015, 3:38am UTC](https://forum.ansible.com/t/weird-issue-with-ec2-eip-module/18443 "2015-06-09T03:38:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [June 9, 2015, 3:38am UTC](https://forum.ansible.com/t/weird-issue-with-ec2-eip-module/18443/1 "2015-06-09T03:38:30Z")

</div>

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"?\>

`InvalidInstanceID.Malformed` **Invalid id: "ec2\_asg\_info.instances**"9c204182-d5b6-41e0-badb-c6e85a9bc8e5

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

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [June 9, 2015, 4:27am UTC](https://forum.ansible.com/t/weird-issue-with-ec2-eip-module/18443/2 "2015-06-09T04:27:30Z")

</div>

you have **var=“{{ ec\_asg\_info.instances }}”**

**and in with\_items: ec2\_asg\_info shouldnt it be : e\*\*\*\*c\_asg\_info**

---

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [June 9, 2015, 4:44am UTC](https://forum.ansible.com/t/weird-issue-with-ec2-eip-module/18443/3 "2015-06-09T04:44:30Z")

</div>

I expected to be some syntax error on my side but nothing that obvious and embarrassing ☹

I better go and check my eyes.

Thanks, Benno.  
Igor
