2017-05-29 98 views
1

Ansible版本:Ansible出現了一些問題RuntimeError

ansible 2.3.0.0 
    configured module search path = Default w/o overrides 
    python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] 

想運行一個劇本。目標是流浪。有時,當我運行 「安裝Python」 任務:

- name: 
    yum: 
    name: python 
    state: present 

我得到這個錯誤:

fatal: [192.168.0.1]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Warning: Permanently added '192.168.0.1' (ECDSA) to the list of known hosts.\r\nConnection to 192.168.0.1 closed.\r\n", "module_stdout": "Trac 
eback (most recent call last):\r\n File \"/tmp/ansible_l93xpj/ansible_module_yum.py\", line 249, in <module>\r\n from ansible.module_utils.urls import fetch_url\r\n File \"/tmp/ansible_l93xpj/ansible_modlib.zip/ansible/module_utils/ 
urls.py\", line 152, in <module>\r\n File \"/usr/lib/python2.7/site-packages/requests/__init__.py\", line 74, in <module>\r\n raise RuntimeError('Requests dependency \\'chardet\\' must be version >= 3.0.2, < 3.1.0!')\r\nRuntimeError: 
Requests dependency 'chardet' must be version >= 3.0.2, < 3.1.0!\r\n", "msg": "MODULE FAILURE", "rc": 0} 

當我檢查192.168.0.1,Python的版本:

Python 2.7.5

爲什麼我收到這個錯誤?

回答

2
Requests dependency 'chardet' must be version >= 3.0.2, < 3.1.0! 

Why got this error?

因爲您的目標機器沒有包含chardet的版本號等於或大於3.0.2的包。

+0

我檢查了本地和流浪(192.168.0.1):'pip freeze | grep chardet',他們都得到了'chardet == 3.0.3'。 –

+0

您可能正在檢查與Ansible運行不同的Python。 – techraf

+0

即使我使用'pyenv'安裝了一個新的python版本,一個非常新鮮的pip列表。結果是一樣的。我認爲問題不在於機器是否具有「字符集」。 –