0

I built an RPM for RH5 and I'm running into issues with some of the modules I need. First things first, I'm running Ansible 1.9.2. Now, once the RPM is installed, running ansible --version returns the following.

> ansible --version
ansible 1.9.2
configured module search path = None

One of the modules I need is Hipchat, which is throwing an SSL error.

PROTOCOL = ssl.PROTOCOL_TLSv1
NameError: name 'ssl' is not defined

Now, if I set PYTHONPATH to ~/ansible/lib everything works fine. ~ansible is a 1.9 copy from source. My RPM installs the Ansible libraries into /usr/lib/python2.6/site-packages/ansible. So if I point PYTHONPATH to that path, my module doesn't work and it doesn't show what I normally see below.

ansible 1.9.2 (stable-1.9 b70caac618) last updated 2015/06/05 15:22:40 (GMT-400)
lib/ansible/modules/core: (detached HEAD 618806aeeb) last updated 2015/03/04 12:39:45 (GMT -400)
lib/ansible/modules/extras: (detached HEAD 945da71ce4) last updated 2015/03/04 12:39:53 (GMT -400)
v2/ansible/modules/core: (detached HEAD 34784b7a61) last updated 2015/03/04 12:40:03 (GMT -400)
v2/ansible/modules/extras: (detached HEAD 650d740a3a) last updated 2015/03/04 12:40:10 (GMT -400)
configured module search path = None
sdot257
  • 10,046
  • 26
  • 88
  • 122

1 Answers1

1

Python 2.6 does not have built-in SSL support. You need to install PyOpenSSL from your distribution packages.

Adding SSL support to Python 2.6

https://pyopenssl.readthedocs.org/en/stable/

Community
  • 1
  • 1
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • Then explain why it works if I source the env-setup file? – sdot257 Jul 24 '15 at 19:10
  • Sorry I don't get the context of env-setup comment – Mikko Ohtamaa Jul 24 '15 at 19:13
  • The `env-setup` file sets up my environment for Ansible to run correctly. The only difference I see is that it points to a different location to the one that comes w/ the RPM version. Thx though. – sdot257 Jul 24 '15 at 19:14
  • On the working environemnt you can do `import _ssl ; print _ssl.__file__` to see where the working SSL is lurking. – Mikko Ohtamaa Jul 24 '15 at 19:18
  • Also I suggest you do not manually point PYTHONPATH, but instead use virtualenv: https://packaging.python.org/en/latest/installing.html#creating-virtual-environments - and install ansible using `pip` - this way some issues with native libraries show up on your face with errors and become easier to tackle – Mikko Ohtamaa Jul 24 '15 at 19:19