在 Windows 机器上通过 Ansible 安装 Oracle 客户端 - 退出代码 259, 1
我正在尝试通过 Ansible 在 Windows Server 2016 上安装 Oracle Client 12c.
I'm trying to install Oracle Client 12c on a Windows Server 2016 via Ansible.
我尝试了各种安装客户端的选项:
I have tried various options to install the client:
选项 1
- name: "Install Oracle Client"
win_command: "C:\\Temp\\Software\\Oracle-Client\\client\\setup.exe -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile C:\\Temp\\Software\\Oracle-Client\\client\\response\\client.rsp"
我得到的错误代码是:
fatal: [windoze]: FAILED! => {
"changed": true,
"cmd": "C:\\Temp\\Software\\Oracle-Client\\client\\setup.exe -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile C:\\Temp\\Software\\Oracle-Client\\client\\response\\client.rsp",
"delta": "0:00:10.592896",
"end": "2018-11-22 12:34:33.774009",
"msg": "non-zero return code",
"rc": 1,
"start": "2018-11-22 12:34:23.181113",
"stderr": "",
"stderr_lines": [],
"stdout": "\r\n Exit code of OUI process 1=",
"stdout_lines": [
"",
" Exit code of OUI process 1="
]
}
选项 2
- name: "Install Oracle Client"
win_package:
path: C:\Temp\Software\Oracle-Client\client\setup.exe
creates_path: C:\app\client_1
arguments:
- "-silent -noconsole -waitforcompletion -responseFile C:\\Temp\\Software\\Oracle-Client\\client\\response\\client.rsp"
state: present
我得到的错误是:
fatal: [windoze]: FAILED! => {
"changed": false,
"exit_code": 1,
"msg": "unexpected rc from install C:\\Temp\\Software\\Oracle-Client\\client\\setup.exe: see rc, stdout and stderr for more details",
"rc": 1,
"reboot_required": false,
"restart_required": false,
"stderr": "",
"stderr_lines": [],
"stdout": "\r\n Exit code of OUI process 1=",
"stdout_lines": [
"",
" Exit code of OUI process 1="
]
}
选项 3
- name: "Install Oracle Client"
win_shell: "C:\\Temp\\Software\\Oracle-Client\\client\\setup.exe -silent -waitforcompletion -nowelcome -noconfig -debug -force -responseFile C:\\Temp\\Software\\Oracle-Client\\client\\response\\client.rsp"
这次的结果是不同的,其中 RC 为 1,但实际上并没有在服务器上安装任何东西
The result is different this time where the RC is 1, but it doesn't actually install anything on the server
changed: [windoze] => {
"changed": true,
"cmd": "C:\\Temp\\Software\\Oracle-Client\\client\\setup.exe -silent -waitforcompletion -nowelcome -noconfig -debug -force -responseFile C:\\Temp\\Software\\Oracle-Client\\client\\response\\client.rsp",
"delta": "0:00:09.554881",
"end": "2018-11-22 12:51:00.633519",
"rc": 0,
"start": "2018-11-22 12:50:51.078638",
"stderr": "",
"stderr_lines": [],
"stdout": "\r\n Exit code of OUI process 1=",
"stdout_lines": [
"",
" Exit code of OUI process 1="
]
}
上述每个命令都在服务器上手动运行,所以我知道这不是命令本身的问题.似乎在运行安装程序时启动了一个 java 进程,这在通过 Ansible 调用时会导致此问题.有谁知道我如何通过 Ansible 成功安装它?
Each of the commands above work manually on the server, so I know that it is not an issue with the commands themselves. It appears that a java process starts when the installer is run which causes this issue when invoked via Ansible. Does anyone know how I can successfully install this via Ansible?
推荐答案
您需要使用 -waitforcompletion 选项,以获取错误 0.此选项仅支持本地执行(例如 bat).这是有效的:
You need use -waitforcompletion option, in order to get error 0. This option support only local execute (for example bat). This is working:
就我而言是:
- name: Execute bat file
script: files/run.bat
args:
creates: C:\app\oracle
运行.bat
C:\OracleClient\client32\setup.exe -silent -nowait -noconsole -waitforcompletion -responseFile "C:\OracleClient\client.rsp"
这里有更多信息
相关文章