【问题标题】:Ansible something went wrong with RuntimeErrorAnsible RuntimeError 出了点问题
【发布时间】:2017-05-29 07:53:20
【问题描述】:

Ansible 版本:

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

为什么会出现这个错误?

【问题讨论】:

    标签: python vagrant ansible


    【解决方案1】:
    Requests dependency 'chardet' must be version >= 3.0.2, < 3.1.0!
    

    为什么会出现这个错误?

    因为您的目标机器没有安装包chardet,版本号等于或大于3.0.2。

    【讨论】:

    • 我检查了本地和流浪者(192.168.0.1):pip freeze | grep chardet,他们都得到了chardet==3.0.3
    • 您检查的 Python 可能与 Ansible 运行的不同。
    • 即使我用pyenv安装了一个新的python版本,一个非常新鲜的pip列表。结果是一样的。我认为问题不在于机器有没有charset
    • 我能为您做什么?
    • 我知道原因!主机192.168.0.1 有一个默认的旧chardet 版本:chardet==2.2.1。删除它一切正常。
    猜你喜欢
    • 2016-01-01
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    相关资源
    最近更新 更多