pyOpenSSL is in Python path but Ansible does not see it (Openssl_certificate module)

When trying to run the Openssl_certificate module with provider=assertonly I am getting

“The python pyOpenSSL library is required”

but it looks like that is available to Python:

python -m OpenSSL.debug
`

pyOpenSSL: 17.5.0
cryptography: 2.1.4
cffi: 1.11.4
cryptography’s compiled against OpenSSL: OpenSSL 1.1.0g 2 Nov 2017
cryptography’s linked OpenSSL: OpenSSL 1.1.0g 2 Nov 2017
Pythons’s OpenSSL: OpenSSL 1.0.1e-fips 11 Feb 2013
Python executable: /bin/python
Python version: 2.7.5 (default, Aug 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
Platform: linux2
sys.path: [‘’, ‘/usr/lib64/python27.zip’, ‘/usr/lib64/python2.7’, ‘/usr/lib64/python2.7/plat-linux2’, ‘/usr/lib64/python2.7/lib-tk’, ‘/usr/lib64/python2.7/lib-old’, ‘/usr/lib64/python2.7/lib-dynload’, ‘/usr/lib64/python2.7/site-packages’, ‘/usr/lib/python2.7/site-packages’]
`

my ansible version:

ansible 2.4.2.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

Do I need to add somethign to Ansible config?

thank you

I guess you are running this on the remote host and not localhost so you need to install the requirement on the remote host.