# ansible 1.6: ec2\_lc does not function?

**URL:** <https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772>\
**Category:** Ansible Project\
**Created:** [March 14, 2014, 2:56pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772 "2014-03-14T14:56:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Perrett](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Timothy\_Perrett](https://forum.ansible.com/u/Timothy_Perrett)\
**Post date:** [March 14, 2014, 2:56pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/1 "2014-03-14T14:56:43Z")

</div>

Hey all,

I’m just trying out the ec2\_lc stuff and it appears to be non-functioning. I tried the following:

- ec2\_lc:  
name=special  
image\_id=“ami-XXX”  
key\_name=default  
security\_groups=‘group,group2’

But I get this error:

TASK: [ec2\_lc name=special image\_id=“ami-XXX” key\_name=default security\_groups=‘group,group2’] \*\*\*  
failed: [127.0.0.1] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “~/.ansible/tmp/ansible-tmp-1394808739.09-69351858807498/ec2\_lc”, line 1477, in   
main()  
File “~/.ansible/tmp/ansible-tmp-1394808739.09-69351858807498/ec2\_lc”, line 1473, in main  
create\_launch\_config(connection, module)  
File “~/.ansible/tmp/ansible-tmp-1394808739.09-69351858807498/ec2\_lc”, line 1432, in create\_launch\_config  
connection.create\_launch\_configuration(lc)  
AttributeError: ‘NoneType’ object has no attribute ‘create\_launch\_configuration’

FATAL: all hosts have already failed – aborting

So I then tried it exactly as detailed here:  
[http://docs.ansible.com/ec2\_lc\_module.html](http://docs.ansible.com/ec2_lc_module.html)

- ec2\_lc: \>  
name: special  
image\_id: ami-XXX  
key\_name: default  
security\_groups: ‘group,group2’

And then I got this:

TASK: [ec2\_lc name: special image\_id: ami-XXX key\_name: default security\_groups: ‘group,group2’] \*\*\*  
failed: [127.0.0.1] =\> {“failed”: true}  
msg: this module requires key=value arguments ([‘name:’, ‘special’, ‘image\_id:’, ‘ami-XXX’, ‘key\_name:’, ‘default’, ‘security\_groups:’, ‘group,group2’])

FATAL: all hosts have already failed – aborting

Am I doing something wrong or am i just the first person to be using this and its currently a non-functioning module?

Cheers!!

Tim

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 14, 2014, 4:00pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/2 "2014-03-14T16:00:38Z")

</div>

So the traceback needs to be better caught, I agree, and upgrades here would be welcome – this is a new module just added on the 1.6 development branch via pull request a few days ago.

The second problem is one of documentation, the “\>” should not be there if using “colon” syntax for hash members. It instead passed a long string. I’ll take care of this now.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 14, 2014, 4:03pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/3 "2014-03-14T16:03:47Z")

</div>

So when using Ansible, you can do this:

foo: x=1 y=2

or you can do:

foo:  
x: 1  
y: 2

when you say

foo: \>

the “\>” means "what follows is a string continued on the following lines, so that would be:

foo: \>  
x=1  
y=2

It’s better to just do “option1” or “option 2” 🙂

As such, I think the module just choked badly when given bad input in the first case, which is not ideal… but not so bad.

The second case it’s giving you a proper error message about the string being input.

---

<div class="post-metadata">

**Author:** ![Timothy\_Perrett](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Timothy\_Perrett](https://forum.ansible.com/u/Timothy_Perrett)\
**Post date:** [March 14, 2014, 4:38pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/4 "2014-03-14T16:38:18Z")

</div>

Hey Michael,

Thanks for the response. Yeah, im looking to help out if i can. From what you wrote it sounds like the module is barfing on that specific input case, but you noted that input could be given like:

foo:  
x: 1  
y: 2

But when I do:

- name: aws | create launch configuration  
ec2\_lc:  
name: test  
image\_id: “{{ ami\_id }}”  
key\_name: “{{ keypair }}”  
security\_groups: “{{stack\_name.stdout}}”

I get the trace error again. If im reading your note correctly, the configuration I have there should be valid, right?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 14, 2014, 4:41pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/5 "2014-03-14T16:41:16Z")

</div>

The trace may be a thing.

Can you file a github ticket on that last one so we can see if we can reproduce it?

Thanks!

–Michael

---

<div class="post-metadata">

**Author:** ![Timothy\_Perrett](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Timothy\_Perrett](https://forum.ansible.com/u/Timothy_Perrett)\
**Post date:** [March 14, 2014, 4:49pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/6 "2014-03-14T16:49:41Z")

</div>

I started debugging it and see that the `connection` instance is `None`, which is why I believe it explodes.

Will look into it some more, but I filed the ticket here:  
[https://github.com/ansible/ansible/issues/6495](https://github.com/ansible/ansible/issues/6495)

Cheers

---

<div class="post-metadata">

**Author:** ![Timothy\_Perrett](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Timothy\_Perrett](https://forum.ansible.com/u/Timothy_Perrett)\
**Post date:** [March 14, 2014, 4:58pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/7 "2014-03-14T16:58:58Z")

</div>

Ok I have found the issue (despite knowning no python at all).

Problem is that the boto.ec2.autoscale.connect\_to\_region function takes a single region as its argument, not a dict. I’ll try and whip up a pull request to fix the issue.

Cheers

---

<div class="post-metadata">

**Author:** ![Timothy\_Perrett](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@Timothy\_Perrett](https://forum.ansible.com/u/Timothy_Perrett)\
**Post date:** [March 14, 2014, 5:25pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/8 "2014-03-14T17:25:29Z")

</div>

Ok i’ve ‘fixed’ it.

The documentation says that the `region` is not required, but in my haste I had not specified it. Strikes me that region should be marked as required, or the error handler should pickup on the fact that no EC2\_REGION env var is defined, and error out accordingly.

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 14, 2014, 5:34pm UTC](https://forum.ansible.com/t/ansible-1-6-ec2-lc-does-not-function/14772/9 "2014-03-14T17:34:25Z")

</div>

Replied on the ticket here: [https://github.com/ansible/ansible/issues/6495](https://github.com/ansible/ansible/issues/6495)
