Python ansible 2.0.0.2-shutil.rmtree错误,但剧本成功
我在Ubuntu 16.04上运行Ansible 2.0.0.2。我的剧本在ansible 1.9上运行良好,但在剧本运行结束时,我得到以下错误Python ansible 2.0.0.2-shutil.rmtree错误,但剧本成功,python,jenkins,ansible,ubuntu-16.04,Python,Jenkins,Ansible,Ubuntu 16.04,我在Ubuntu 16.04上运行Ansible 2.0.0.2。我的剧本在ansible 1.9上运行良好,但在剧本运行结束时,我得到以下错误 PLAY RECAP ********************************************************************* localhost : ok=62 changed=13 unreachable=0 failed=0 clientnode.com
PLAY RECAP
*********************************************************************
localhost : ok=62 changed=13 unreachable=0 failed=0
clientnode.com : ok=12 changed=3 unreachable=0 failed=0
Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 124, in <module>
shutil.rmtree(C.DEFAULT_LOCAL_TMP, True)
AttributeError: 'module' object has no attribute 'DEFAULT_LOCAL_TMP'
Build step 'Execute shell' marked build as failure
播放回放
*********************************************************************
localhost:确定=62更改=13无法访问=0失败=0
clientnode.com:ok=12 changed=3 unreachable=0 failed=0
回溯(最近一次呼叫最后一次):
文件“/usr/bin/ansible playbook”,第124行,在
rmtree(C.DEFAULT\u LOCAL\u TMP,True)
AttributeError:“module”对象没有“DEFAULT\u LOCAL\u TMP”属性
生成步骤“执行shell”将生成标记为失败
所以剧本是成功的,但是Jenkins的工作因为这个python错误而失败了。
如何解决使用以下命令解决
sudo pip install ansible==2.1.1.0
apt安装包为2.1.1.0,因此pip版本应增加至相同版本 似乎您有冲突的Ansible软件包或安装中断:
/usr/bin/Ansible-…
Ansible 2的脚本,但Ansible 1.9的python软件包。谢谢。如何将python版本转换为相同的版本?我运行了一个/usr/bin/ansible--version,得到了相同的错误。不是“python版本”,而是“ansible python包版本”。这取决于你是如何安装的。我建议删除所有现有的Ansible安装,并通过pip
安装。您不应该同时拥有apt和pip软件包!使用此设置,您可能会遇到各种奇怪的行为。删除所有,只安装一个软件包。