# shell with delegate\_to not working in AWX

**URL:** <https://forum.ansible.com/t/shell-with-delegate-to-not-working-in-awx/28917>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [November 1, 2018, 7:56am UTC](https://forum.ansible.com/t/shell-with-delegate-to-not-working-in-awx/28917 "2018-11-01T07:56:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SS1](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@SS1](https://forum.ansible.com/u/SS1)\
**Post date:** [November 1, 2018, 7:56am UTC](https://forum.ansible.com/t/shell-with-delegate-to-not-working-in-awx/28917/1 "2018-11-01T07:56:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SS1](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@SS1](https://forum.ansible.com/u/SS1)\
**Post date:** [November 1, 2018, 9:04am UTC](https://forum.ansible.com/t/shell-with-delegate-to-not-working-in-awx/28917/2 "2018-11-01T09:04:20Z")

</div>

> figured it and working now. AWX was in containers which was causing the missing path.

Added AWX servers name explicitly to inventory and delegate\_to:
