我的客户端计算机是5.11和python版本2.7,但仍然失败
root@00047BLRSANDEEPC:/mnt/e/Ansible-project/Solarwind/systems_swiagent_install/tests# ansible -i hosts all -m shell -a "cat /etc/redhat-release"
10.XX.XX.XX | FAILED! => {
"changed": false,
"module_stderr": "Shared connection to 10.XX.XX.XX closed.\r\n",
"module_stdout": " File \"/root/.ansible/tmp/ansible-tmp-1561087764.46-1054359176771/AnsiballZ_command.py\", line 39\r\n with open(module, 'wb') as f:\r\n ^\r\nSyntaxError: invalid syntax\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
工作->
root@00047BLRSANDEEPC:/mnt/e/Ansible-project/Solarwind/systems_swiagent_install/tests# ansible -i hosts all -m raw -a "cat /etc/redhat-release"
10.XX.XX.XX | CHANGED | rc=0 >>
CentOS release 5.11 (Final)
Shared connection to 10.XX.XX.XX closed.
答案 0 :(得分:0)
原始模块不需要安装python。因此,它正在提供所需的输出。
运行shell命令时,它无法在该远程主机上检测到python。
尝试在PATH变量中设置python可执行文件。
ansible -i托管所有-m shell -a“ export PATH =
如果可行,请尝试在PATH变量中设置python,然后运行所有命令。