Ansible的安装
安装pycrypto模块
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
# tar xvzf pycrypto-2.6.1.tar.gz
# cd pycrypto-2.6.1
# python setup.py install
(安装的时候如果报错,需要安装依赖包python-devel)
安装PyYAML模块
http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
# tar xvzf yaml-0.1.5.tar.gz
# cd yaml-0.1.5
# ./configure --prefix=/usr/local
# make --jobs=`grep processor /proc/cpuinfo |wc -l`
# make install
https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz
# tar xvzf PyYAML-3.11.tar.gz
# cd PyYAML-3.11
# python setup.py install
安装setuptools
https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
# tar xvzf setuptools-7.0.tar.gz
# cd setuptools-7.0
# python setup.py install
安装Jinja2模块
https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
# tar xvzf MarkupSafe-0.9.3.tar.gz
# cd MarkupSafe-0.9.3
# python setup.py install
https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
# tar xvzf Jinja2-2.7.3.tar.gz
# cd Jinja2-2.7.3
# python setup.py install
安装paramiko模块
https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz
# tar xvzf ecdsa-0.11.tar.gz
# cd ecdsa-0.11
# python setup.py install
https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz
# tar xvzf paramiko-1.15.1.tar.gz
# cd paramiko-1.15.1
# python setup.py install
安装ansible
https://github.com/ansible/ansible/archive/v1.7.2.tar.gz
# tar xvzf ansible-1.7.2.tar.gz
# cd ansible-1.7.2
# python setup.py install
在安装完成之后,配置文件在安装路径之中,如下图所示:
测试
导入paramiko模块报错
在进行导入paramiko模块的时候,报错如下:
python>>import paramiko
(Crypto error: ‘module’ object has no attribute‘HAVE_DECL_MPZ_POWM_SEC’
解决方案:
找到/usr/lib/python2.7/site-packages/Crypto/Util/number.py
把if_fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
注释
#if_fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
在64位的操作系统中,路径看具体的报错提示
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/paramiko/__init__.py", line 30, in <module>
File "build/bdist.linux-x86_64/egg/paramiko/transport.py", line 49, in <module>
File "build/bdist.linux-x86_64/egg/paramiko/dsskey.py", line 26, in <module>
File "/usr/lib64/python2.6/site-packages/Crypto/PublicKey/DSA.py", line 88, in <module>
from Crypto.PublicKey import _DSA, _slowmath, pubkey
File "/usr/lib64/python2.6/site-packages/Crypto/PublicKey/_DSA.py", line 30, in <module>
from Crypto.PublicKey.pubkey import *
File "/usr/lib64/python2.6/site-packages/Crypto/PublicKey/pubkey.py", line 30, in <module>
from Crypto.Util.number import *
File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
附件列表