环境
- Ansible 2.9.9
报错信息
fatal: [demo3]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on ubuntu-bionic's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via
pip install dockeror
pip install docker-py(Python 2.6). The error was: No module named requests.exceptions"}
原因
缺少python
的docker
库
解决方案
我的远程服务器是Ubuntu
,所以可以直接使用apt
安装
sudo apt install docker-python
写在Ansible
的playbook
里边就是
- name: install python docker lib
apt:
name: docker-python
state: present