oravirt/ansible-oracle-modules

cx_Oracle on the Managed Server

anandsolomon opened this issue · 1 comments

Hi,
I am trying to run a sql statement from ansible control server to the Oracle managed server (RDS DB instance). I have oracle instant client, cx_Oracle module installed on the control server. When running a playbook, I am getting the below error.

TASK [sample cx_oracle] ***********************************************************************************
fatal: [22.174.101.30]: FAILED! => {"changed": false, "msg": "The cx_Oracle module is required. Also set LD_LIBRARY_PATH & ORACLE_HOME"}

Here is my playbook

  • hosts: all
    vars:
    oracle_home: /u01/app/oracle/product/12.2.0.1/dbhome_1
    user: tstsch
    password: tstsch
    prt: "1521"
    oracle_env:
    ORACLE_HOME: "{{ oracle_home }}"
    LD_LIBRARY_PATH: "{{ oracle_home }}/lib"

    tasks:

    • name: sample cx_oracle
      oracle_sql:
      username: "{{ user }}"
      password: "{{ password }}"
      port: "{{ prt }}"
      service_name:
      host:
      script: /home/ansible/record.sql
      environment: "{{ oracle_env }}"
      register: select_opt

    • name: display output
      debug:
      var: select_opt