oravirt/ansible-oracle-modules

Getting: "The cx_Oracle module is required.", even though all requirements are satisfied

serpro69 opened this issue · 3 comments

Hi,

I'm facing getting an error when running the modules:

"The cx_Oracle module is required. 'pip install cx_Oracle' should do the trick. If cx_Oracle is installed, make sure ORACLE_HOME & LD_LIBRARY_PATH is set

I have the cx_Oracle installed:

$ pip install cx_Oracle                                                                                                                                                                                                    
Requirement already satisfied: cx_Oracle in ./.virtualenvs/oci/lib/python3.6/site-packages (7.2.3)

ORACLE_HOME and LD_LIBRARY_PATH are also set:

$ echo $ORACLE_HOME                                                                                                                                                                                                        
/opt/oracle/instantclient_19_3
$ echo $LD_LIBRARY_PATH                                                                                                                                                                                                   
/opt/oracle/instantclient_19_3

I have tested the connection to db with sqlplus and that works fine as well.

I can import cx_Oracle from the cli:

$ python       
                                                                                                                                                                  
Python 3.6.8 (default, Oct  7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> print(cx_Oracle.version)
7.2.3
>>>

But for some reason this fails when used from the ansible module.
I thought the python virtual environment might be the reason but I tried installing cx_Oracle outside the venv and it still fails with the same error. Though I have a hunch it's something to do with the virtual env.
Do you know what am I doing wrong here?
Thanks.

Well my thought was correct, the cx_Oracle has to be installed for /usr/bin/python. Is there any way to make it work with virtualenv?

Thanks @tdavison784, will try that.
I have tried setting that var from playbook, but that didn't work (maybe because of variable precedence). Haven't thought to set it from command line though.
I suppose the issue can be closed since this is unrelated to the ansible-oracle-modules