ec2_elb_lb module fails with trivial example

282 views
Skip to first unread message

i iordanov

unread,
Apr 4, 2014, 11:17:39 AM4/4/14
to ansible...@googlegroups.com
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.

===================================================
 name: Start load-balancers
      ec2_elb_lb:
        aws_access_key: "{{ ec2_access_key }}"
        aws_secret_key: "{{ ec2_secret_key }}"
        name: "test-please-delete"
        state: present
        zones:
          - us-east-1a
          - us-east-1d
        listeners:
          - protocol: http # options are http, https, ssl, tcp
            load_balancer_port: 80
            instance_port: 80
===================================================

When ansible gets to this task, it hangs for a while and then reports the following error. Since the error occurs in python-httplib2, I tried updating it from 0.7 (Debian wheezy) to 0.8 (Debian testing), but that didn't help either:

TASK: [Start load-balancers] **************************************************
failed: [localhost] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb", line 1880, in <module>
    main()
  File "/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb", line 503, in main
    aws_secret_key, region=region)
  File "/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb", line 210, in __init__
    self.elb = self._get_elb()
  File "/root/.ansible/tmp/ansible-tmp-1396624105.37-127079892448911/ec2_elb_lb", line 266, in _get_elb
    elbs = self.elb_conn.get_all_load_balancers()
  File "/usr/lib/python2.7/dist-packages/boto/ec2/elb/__init__.py", line 124, in get_all_load_balancers
    [('member', LoadBalancer)])
  File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 1143, in get_list
    response = self.make_request(action, params, path, verb)
  File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 1089, in make_request
    return self._mexe(http_request)
  File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 922, in _mexe
    request.body, request.headers)
  File "/usr/lib/python2.7/httplib.py", line 962, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 996, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 958, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 818, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 780, in send
    self.connect()
  File "/usr/lib/python2.7/dist-packages/boto/https_connection.py", line 111, in connect
    sock.connect((self.host, self.port))
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known


FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************

Many Thanks!
iordan

Michael DeHaan

unread,
Apr 4, 2014, 11:20:36 AM4/4/14
to ansible...@googlegroups.com
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:


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



--
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.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/476a6c16-fec2-42b0-970c-f3e3754c2d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

i iordanov

unread,
Apr 4, 2014, 11:27:01 AM4/4/14
to ansible...@googlegroups.com
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
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/dUQ0OpTkLBs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEVJ8QPu%3DncFtGS-fA%3DjjipVFF3b7GeKRQTDhuVx%3D0MG_ecKYA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
The conscious mind has only one thread of execution.

benno joy

unread,
Apr 4, 2014, 11:44:07 AM4/4/14
to ansible...@googlegroups.com

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

 


i iordanov

unread,
Apr 4, 2014, 12:36:21 PM4/4/14
to ansible...@googlegroups.com
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
> https://groups.google.com/d/msgid/ansible-project/CAFUV_d5GhvVY9v6GwJOXwZOsiWHcsYa_pfE5Up39-q_n9o1p9w%40mail.gmail.com.

Michael DeHaan

unread,
Apr 4, 2014, 2:07:22 PM4/4/14
to ansible...@googlegroups.com
We should either add the region parameter as universally required or provide sensible defaults.

Please do file a bug on this.

Thanks!


Michael DeHaan

unread,
Apr 4, 2014, 2:07:56 PM4/4/14
to ansible...@googlegroups.com
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"

Will Thames

unread,
Apr 9, 2014, 2:40:34 AM4/9/14
to ansible...@googlegroups.com
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

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

Will Thames

unread,
Apr 9, 2014, 9:01:13 AM4/9/14
to ansible...@googlegroups.com
https://github.com/ansible/ansible/pull/6914 should fix this (requires 6913 to be accepted too)

Will

Michael DeHaan

unread,
Apr 9, 2014, 9:31:05 AM4/9/14
to ansible...@googlegroups.com
Yeah send us a PR?

Thanks!


Will Thames

unread,
Apr 9, 2014, 9:34:43 AM4/9/14
to ansible...@googlegroups.com
You replied to my message referencing my PR.

Hope the PR is satisfactory :)

Will
Reply all
Reply to author
Forward
0 new messages