# ec2\_elb\_lb module fails with trivial example

**URL:** <https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 4, 2014, 3:17pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939 "2014-04-04T15:17:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![i\_iordanov](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@i\_iordanov](https://forum.ansible.com/u/i_iordanov)\
**Post date:** [April 4, 2014, 3:17pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/1 "2014-04-04T15:17:39Z")

</div>

Hello!

I may be doing something wrong, but I tried so many different things, I though it should report just in case. So far, I’ve tried Ansible 1.5 built from the repository and from Debian testing, and Ansible 1.6 (build from today’s devel branch state). Also, I’ve tried with python-boto 2.9.x (from Ubuntu Saucy), 2.25 (Debian testing), and 2.27 (Debian unstable). The platform I’m running on is Debian Wheezy because I wanted everything else to be rock-solid.

I’ve tried simplifying my DNS settings to just leaving “nameserver 8.8.8.8” just in case it was a DNS issue.

Here is the absolutely trivial ec2\_elb\_lb configuration that fails and the error it fails with. This is the example almost straight out of the online manual. I started with a much more complicated config and eventually decided to trivialize it to see if the error still recurs, and indeed it does.

---

<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:** [April 4, 2014, 3:20pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/2 "2014-04-04T15:20:36Z")

</div>

There have been some tickets open about ec2\_elb recently:

Please review the following and see if your issues are addressed by the latest on the development branch:

[https://github.com/ansible/ansible/search?q=ec2\_elb&ref=cmdform&type=Issues](https://github.com/ansible/ansible/search?q=ec2_elb&ref=cmdform&type=Issues)

If not and you are still seeing issues on the development branch, please open a new ticket.

---

<div class="post-metadata">

**Author:** ![i\_iordanov](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@i\_iordanov](https://forum.ansible.com/u/i_iordanov)\
**Post date:** [April 4, 2014, 3:27pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/3 "2014-04-04T15:27:01Z")

</div>

Hi Michael,

I just built Ansible from the latest devel branch and I'm still seeing  
the same error. I don't quite understand whether I need to patch the  
devel branch with anything before testing.

If not, I've already tested with the latest devel branch and this is a new bug.

Thanks!  
iordan

---

<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:** [April 4, 2014, 3:44pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/4 "2014-04-04T15:44:07Z")

</div>

Can you try passing “region: foo” as a parameter and see if that helps.

---

<div class="post-metadata">

**Author:** ![i\_iordanov](https://avatars.discourse-cdn.com/v4/letter/i/b3f665/32.png) [@i\_iordanov](https://forum.ansible.com/u/i_iordanov)\
**Post date:** [April 4, 2014, 4:36pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/5 "2014-04-04T16:36:21Z")

</div>

Hi Benno,

Thanks, that did help. Now I get further. So this is a documentation issue.

Now I am suffering from a lack of a feature which is a different  
issue. With the current code, I am unable to place the ELB into a VPC  
which is necessary for my use-case.

Cheers!  
iordan

---

<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:** [April 4, 2014, 6:07pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/6 "2014-04-04T18:07:22Z")

</div>

We should either add the region parameter as universally required or provide sensible defaults.

Please do file a bug on this.

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:** [April 4, 2014, 6:07pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/7 "2014-04-04T18:07:56Z")

</div>

I didn’t mean defaults – I mean “we should set this as universally required because we can’t provide sensible defaults, or at least when the module needs it”

---

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [April 9, 2014, 6:40am UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/8 "2014-04-09T06:40:34Z")

</div>

Actually, that’s not entirely true.

The connect\_to\_aws and connect\_to\_ec2 methods both use the get\_aws\_connection\_info under the hood, which checks EC2\_REGION, AWS\_REGION, module.params[‘region’] and boto config’s region before giving up and returning None (at which point the calling module should probably fail)  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/ec2.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/ec2.py)

The problem is that the ELB modules have yet to be rewritten to use the common code, but I’d probably favour that over mandating that region be provided.

Will

---

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [April 9, 2014, 1:01pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/9 "2014-04-09T13:01:13Z")

</div>

[https://github.com/ansible/ansible/pull/6914](https://github.com/ansible/ansible/pull/6914) should fix this (requires 6913 to be accepted too)

Will

---

<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:** [April 9, 2014, 1:31pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/10 "2014-04-09T13:31:05Z")

</div>

Yeah send us a PR?

Thanks!

---

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [April 9, 2014, 1:34pm UTC](https://forum.ansible.com/t/ec2-elb-lb-module-fails-with-trivial-example/14939/11 "2014-04-09T13:34:43Z")

</div>

You replied to my message referencing my PR.

Hope the PR is satisfactory 🙂

Will
