现象:
网内一台rhel5.2的姥爷服务器一直无法ansible
playbook 报错
Error: ansible requires the stdlib json or simplejson module, neither was found!
原因:
python版本问题.
python-2.4.3-21.el5
解决:
方法一: 手动安装了python2.7
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出现问题.
因为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