以下是我的 playbook:
---
- hosts: UAT
gather_facts: false
remote_user: xxxx
become_method: sudo
become: yes
become_user: sudo_user
tasks:
- name: Fetch Java version
command: java -version
register: java_result
ignore_errors: True
- debug: "msg={{ java_result.stdout }}"
...
我遇到了以下错误:
fatal: [ma-dsast-lapp10]: FAILED! => {
"changed": false,
"cmd": "java -version '2>&1' '|' grep version",
"failed": true,
"invocation": {
"module_args": {
"_raw_params": "java -version 2>&1 | grep version",
"_uses_shell": false,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"warn": true
}
},
"msg": "[Errno 2] No such file or directory",
"rc": 2
}
我遇到了“没有此文件或目录”的错误。
可能是什么问题呢? 请帮忙解决一下。
become_user: '{{ global_vars.user_session }}' // your user session
register: java_result ignore_errors: True
dsservt
)的系统路径中包含Java吗? - nwinkler