I'v tried to run some docker modules in ansible and get exact same error
- name: Get infos on container
docker_container_info:
name: gitlab
- name: Create gitlab container
community.docker.docker_container:
name: gitlab
image: gitlab/gitlab-ce
An exception occurred during task execution. To see the full traceback, use -vvv. The error was:
ModuleNotFoundError: No module named 'docker'
fatal: [172.16.86.38]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or docker before 5.0.0 (Python 2.7) or docker-py (Python 2.6)) on localhost.localdomain's Python /usr/bin/python3. Please read the module documentation and install it 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 docker` (Python >= 3.6) or `pip install docker==4.4.4` (Python 2.7) or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
Ansible installed via dnf (i tried pip too, no matter), ansible modules loaded
python -V
Python 3.9.13
also was this..
pip3 install docker --force
python3 -c "import docker"
and this
[hostname:vars]
ansible_python_interpreter=/usr/bin/python3
source https://stackoverflow.com/questions/73114267/no-module-named-docker
Comments
Post a Comment