全網首發-ansbile故障解決方案匯總

來源:互聯網
上載者:User

標籤:解決方案   ansible   

一、錯誤發現

運行ansbile時候報錯:
[[email protected] modules]#ansible --version
Traceback (most recent call last):
  File "/usr/bin/ansible", line 45, in <module>
    import ansible.constants as C 
  ImportError: No module named ansible.constants

解決思路:由於之前使用的python2.7編譯安裝的ansible2.0.1版本,但由於升級卸載掉了。從本質來看可以判斷是缺少modules。


二、開始解決

[[email protected] modules]# cd /usr/local/lib/python2.7/site-packages/
[[email protected] site-packages]# ls
Crypto
easy-install.pth
ecdsa
ecdsa-0.11-py2.7.egg-info
Jinja2-2.7.3-py2.7.egg
MarkupSafe-0.9.3-py2.7-linux-x86_64.egg
paramiko-1.15.1-py2.7.egg
pycrypto-2.6.1-py2.7.egg-info
PyYAML-3.11-py2.7.egg-info
README
setuptools-7.0-py2.7.egg
setuptools.pth
simplejson-3.6.5-py2.7-linux-x86_64.egg
yaml
_yaml.so

問題來了:這裡沒看到ansible目錄,我們在查看python2.6下

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/83/D0/wKiom1d83lmRtz4eAACj9SeCfks825.png-wh_500x0-wm_3-wmp_4-s_2755732618.png" title="QQ20160706183234.png" alt="wKiom1d83lmRtz4eAACj9SeCfks825.png-wh_50" />

發現新版本的ansible2.1(使用的是python2.6版本)

解決:

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/83/CE/wKioL1d83pyw6Qr0AABwsBScdTw781.png-wh_500x0-wm_3-wmp_4-s_4250328149.png" title="QQ20160706183358.png" alt="wKioL1d83pyw6Qr0AABwsBScdTw781.png-wh_50" />

[[email protected] site-packages]# ansible --version
/usr/local/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
ansible 2.1.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

那麼問題來了:這裡又出現報錯。

三、解決錯誤問題2

根據提示進入

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/83/D0/wKiom1d830uySHKpAAC6Yug-WjY133.png-wh_500x0-wm_3-wmp_4-s_2319740902.png" title="QQ20160706183650.png" alt="wKiom1d830uySHKpAAC6Yug-WjY133.png-wh_50" />

紅色標記部分預設沒注釋,這裡解釋下報錯資訊:libgmp 版本需要>= 5,而環境不滿足。

解決方案有2:

1、注釋掉這兩行,不影響使用,只是把錯誤隱藏而已。最根本解決升級libgmp版本即可。

2、按要求升級libgmp版本。

四、問題已解決

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/83/D0/wKiom1d84AyTr9MrAACZvMJsx5w061.png-wh_500x0-wm_3-wmp_4-s_839553471.png" title="QQ20160706183952.png" alt="wKiom1d84AyTr9MrAACZvMJsx5w061.png-wh_50" />

本文出自 “用心創造價值,晚點咖啡” 部落格,請務必保留此出處http://wandiankafei.blog.51cto.com/10878910/1811609

全網首發-ansbile故障解決方案匯總

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.