ansible自动化运维 cryptography 0.8.2 版本兼容性报错解决办法

在管理端向客户机执行 ansible Client -m ping 时


报错:ERROR! Unexpected Exception, this is probably a bug: VersionConflict: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse('cryptography>=1.1'))


    from ansible.parsing.vault import VaultLib
  File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 45, in <module>
    from cryptography.hazmat.backends import default_backend
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3011, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 630, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
VersionConflict: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse('cryptography>=1.1'))

分析原因 :cryptography版本过低

解决方法:cryptography需要通过pip安装,所以需要先安装pip


1.安装pip

https://pypi.org/project/pip/#files

下载pip-10.0.1.tar.gz

tar -zxvf pip-10.0.1.tar.gz

cd pip-10.0.1

python setup.py install

2.安装wheel

https://pypi.org/project/wheel/#files

下载wheel-0.31.1.tar.gz

tar -zxvf wheel-0.31.1.tar.gz

cd wheel-0.31.1

python setup.py install

做完这一步后,可以进行pip安装了。

3.安装cryptography 2.2.2

https://pypi.org/project/cryptography/

下载cryptography-2.2.2-cp27-cp27mu-manylinux1_x86_64.whl

pip install cryptography-2.2.2-cp27-cp27mu-manylinux1_x86_64.whl

等待安装完成,再次执行ansible Client -m ping 

[root@localhost 0]# ansible Client -m ping 
Enter passphrase for key '/root/.ssh/id_rsa': 
192.168.60.194 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@localhost 0]# 

问题解决。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值