【发布时间】:2019-03-27 09:19:54
【问题描述】:
使用 ansible 在多个虚拟机上运行 docker swarm。
即使已安装,ansible 也无法在远程机器上找到 python 模块docker。
运行剧本
sudo ansible-playbook -i inv2.py /etc/ansible/playbook.yml
错误信息:
fatal: [10.212.137.216]: FAILED! => {"changed": false, "msg": "Failed to import docker or docker-py - No module named requests.exceptions. Try `pip install docker` or `pip install docker-py` (Python 2.6)"}
模块列表:
ubuntu@donald0:~$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
...
cryptography (2.1.4)
docker (3.7.1)
docker-pycreds (0.4.0)
...
【问题讨论】:
-
找出python的版本“python --version”并确保系统符合Requirements。
-
管理机器:Python 2.7.11 节点机器:Python 2.7.15rc1