现象:python
网内一台rhel5.2的姥爷服务器一直没法ansibleshell
playbook 报错json
Error: ansible requires the stdlib json or simplejson module, neither was found!服务器
缘由:python2.7
python版本问题.ui
python-2.4.3-21.el5code
解决:server
方法一: 手动安装了python2.7get
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz tar -xvf Python-2.7.11.tgz cd Python-2.7.11 ./configure make make test make install mv /usr/bin/python /usr/bin/python.bak ln -sf /usr/bin/python /usr/local/bin/python
这时致使理这台服务器的yum出现问题. it
由于yum调用的python24. 最小改动原则直接编辑 /usr/bin/yum
vi /usr/bin/yum 将: #!/usr/bin/python 改成 #!/usr/bin/python2.4
OK了
方法 二:
简便办法:
仍是安装python2.7
而后修改 ansible server中 这个主机的解释器配置.
ansible_python_interpreter=/usr/local/bin/python