AWX 1.0.6.8, Ansible 2.5.4
I have a playbook to check the system params and at the end want to insert it to oracle DB. I am using sqlplus with shell module, I am not allowed to install cx_oracle module
-
name: Create sql for OCT DB
template:
src: oct.sql.j2
dest: /tmp/oct.sql
delegate_to: 127.0.0.1
become: false -
name: Add to OCT oracle DB
shell: |
echo exit | sqlplus -S @/tmp/oct.sql
args:
chdir: ‘/usr/lib/oracle/11.2/client64/bin/’
executable: /bin/bash
environment:
LD_LIBRARY_PATH: “/usr/lib/oracle/11.2/client64/lib:$LD_LIBRARY_PATH”
PATH: “{{ ansible_env.PATH }}:/usr/lib/oracle/11.2/client64/bin”
register: sql_out
delegate_to: localhost
become: false
I am getting below error and seems not reading the environment variables and could find sqlplus to execute. Without chdir args it says cannot find sqlplus. Using fullpath of sqlplus says file not exist.
“_ansible_parsed”: false,
“exception”: “Traceback (most recent call last):\n File "/tmp/ansible_mHZC4s/ansible_module_command.py", line 248, in \n main()\n File "/tmp/ansible_mHZC4s/ansible_module_command.py", line 192, in main\n os.chdir(chdir)\nOSError: [Errno 2] No such file or directory: ‘/usr/lib/oracle/11.2/client64/bin’\n”,
“_ansible_no_log”: false,
“_ansible_delegated_vars”: {
“ansible_delegated_host”: “localhost”,
“ansible_host”: “localhost”
},
wondering I am doing something wrong here as it work with ansible core but not on AWX