任务执行期间发生异常

时间:2016-08-09 12:55:14

标签: ansible

http://docs.ansible.com/ansible/intro_installation.html之后我做了

echo "127.0.0.1" > /etc/ansible/hosts

然后

ansible all -m ping --ask-pass
SSH password: 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'EntryPoint' object has no attribute 'resolve'
127.0.0.1 | FAILED! => {
    "failed": true, 
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}

所以,使用-vvv我得到:

ansible -vvv all -m ping --ask-pass
No config file found; using defaults
SSH password: 
Using module file /Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/modules/core/system/ping.py
<127.0.0.1> ESTABLISH CONNECTION FOR USER: None on PORT 22 TO 127.0.0.1
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/executor/task_executor.py", line 120, in run
    res = self._execute()
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/executor/task_executor.py", line 457, in _execute
    result = self._handler.run(task_vars=variables)
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/action/normal.py", line 33, in run
    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/action/__init__.py", line 583, in _execute_module
    tmp = self._make_tmp_path(remote_user)
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/action/__init__.py", line 218, in _make_tmp_path
    result = self._low_level_execute_command(cmd, sudoable=False)
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/action/__init__.py", line 726, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/connection/paramiko_ssh.py", line 251, in exec_command
    super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/connection/__init__.py", line 51, in wrapped
    self._connect()
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/connection/paramiko_ssh.py", line 139, in _connect
    self.ssh = SSH_CONNECTION_CACHE[cache_key] = self._connect_uncached()
  File "/Users/Snowcrash/Developer/Ansible/ansible/lib/ansible/plugins/connection/paramiko_ssh.py", line 208, in _connect_uncached
    ssh.load_system_host_keys()
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/paramiko/client.py", line 101, in load_system_host_keys
    self._system_host_keys.load(filename)
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/paramiko/hostkeys.py", line 101, in load
    e = HostKeyEntry.from_line(line, lineno)
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/paramiko/hostkeys.py", line 331, in from_line
    key = RSAKey(data=decodebytes(key))
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/paramiko/rsakey.py", line 58, in __init__
    ).public_key(default_backend())
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/cryptography/hazmat/backends/__init__.py", line 35, in default_backend
    _default_backend = MultiBackend(_available_backends())
  File "/Users/Snowcrash/Library/Python/2.7/lib/python/site-packages/cryptography/hazmat/backends/__init__.py", line 22, in _available_backends
    "cryptography.backends"
AttributeError: 'EntryPoint' object has no attribute 'resolve'

127.0.0.1 | FAILED! => {
    "failed": true, 
    "msg": "Unexpected failure during module execution.", 
    "stdout": ""
}

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

AttributeError: 'EntryPoint' object has no attribute 'resolve'是因加载的setuptools版本太旧而导致的错误。尝试升级环境中的setuptools。

cryptography记录>=11.3setup.py)的最小setuptools版本,但有时pip可能无法强制执行此要求。