由于公司现有的环境的原因:
目前有redhat4 redhat5 centos6 centos7
在云端上面部署的时候,发现一切都很正常,准备部署到公司进行测试。
安装ansible服务器这里就不说了
安装好发现推送的时候报如下的错误。
"changed": false,
"module_stderr": "Shared connection to 192.168.166.85 closed.\r\n",
"module_stdout": " File \"/root/.ansible/tmp/ansible-tmp-1557400333.44-113544688602620/AnsiballZ_ping.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
}
就是语法的错误,折腾了很久,也查过很多资料;
发现问题原因是:这些机器的python版本大部分是python2.4 导致语法有问题
问题找到就比较好解决了
方法一:
升级python2.4到py