Closed HCLDREAM closed 4 years ago
Supplement my main.yml
Hi Hcldream,
you need the cx_Oracle on the controlled host, not on the controller. Please check and report.
Kind Regards, Dietmar
cx_Oracle is the Python library that is used to manipulate the database and work with Oracle clients. What is the use of it being installed on a Oracle server? @duhlig
The module uses cx_Oracle to connect to the database.
For this specific module, the task can be executed on the controller or the database server, so that's up to you.
If you're executing on the controller you need to specify delegate_to: localhost
in the task, or use connection: local
at the playbook level.
If you want to run it on the database server you need to install cx_Oracle.
Thank you very much, the problem has been solved, I have not set delegate_to:localhost @oravirt
@HCLDREAM: Although your problem has already been solved I'd like to answer. My first reply was to short and incomplete. This is how ansible works: The playbook and the roles are "executed" on the controller. The module (e.g. oracle_sql) usually gets copied to the controlled host and executed there. That's why you need Python on the controlled host and every Python library that is included in the Ansible module (e.g. cx_Oracle). If it's not necessary or not desirable to run the module on the controlled host (because for instance cx_Oracle does the net connection itself) you can delegate the execution of the module to another machine (localhost in most cases). This was Mikael's hint I forgot in my first reply.
Kind regards, Dietmar
Hi! I would like to know why my playbook execution failed, is it convenient for me to see the specific reason? my cx_Oracle has been installed. Looking forward to your reply.