[FAQ] Ansbile 部署安装报错,/bin/sh: /usr/bin/python: No such file or directory

【问题澄清】

  • ansible 部署 dm/tidb 集群,执行到通过 ansible 命令验证 tidb 用户时报错:

FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.100 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 } dm_portal | FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.101 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 } grafana | FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.101 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 } alertmanager | FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.101 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 } prometheus | FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.101 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 } dm_master | FAILED! => { “changed”: false, “module_stderr”: “Shared connection to 10.8.14.101 closed.\r
”, “module_stdout”: “/bin/sh: /usr/bin/python: No such file or directory\r
”, “msg”: “MODULE FAILURE”, “rc”: 127 }

【原因分析】

  • 可以看到具体的报错信息为(上文已经突出显示): /bin/sh: /usr/bin/python: No such file or directory

【解决方案】

  • 将该路径 ln 到 python2.7 的位置,或者安装 python2.7

【参考案例】