我已经安装了oracle客户端(/usr/lib/oracle/12.2/client64),在该目录下,我有两个目录bin和lib。
我可以使用以下命令连接到数据库:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/12.2/client64/lib
./sqlplus "jirauser/jirauser_cats@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=xxxxx)(PORT=1521))(CONNECT_DATA=(SID=xxx)))"
但是当我将相同的命令放入ansible剧本中时,以下剧本会失败并显示
./ sqlplus:加载共享库时出错:libsqlplus.so:无法打开共享对象文件:没有这样的文件或目录
---
- hosts: localhost
tasks:
- name: include groups.yml
include_vars: group_vars/all.yml
- name: deprod
shell: chdir=/usr/lib/oracle/12.2/client64/bin ./sqlplus "jirauser/jirauser_cats@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx24)(PORT=1521))(CONNECT_DATA=(SID=xxx)))";