trying to get this module to work and docker-compose down and up
---
- name: docker compose down
hosts: ubuntu
tasks:
- name: docker compose down
community.docker.docker_compose:
project_src: /home/tony/docker/compose-demo
build: no
stopped: yes
register: output
- debug:
var: output
but output I got was
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_community.docker.docker_compose_payload_gv41w54x/ansible_community.docker.docker_compose_payload.zip/ansible_collections/community/docker/plugins/module_utils/common.py", line 33, in <module>
from docker import __version__ as docker_version
ModuleNotFoundError: No module named 'docker'
fatal: [192.168.0.122]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_version": "auto",
"build": false,
"ca_cert": null,
"client_cert": null,
"client_key": null,
"debug": false,
"definition": null,
"dependencies": true,
"docker_host": "unix://var/run/docker.sock",
"env_file": null,
"files": null,
"hostname_check": false,
"nocache": false,
"profiles": null,
"project_name": null,
"project_src": "/home/tony/docker/compose-demo",
"pull": false,
"recreate": "smart",
"remove_images": null,
"remove_orphans": false,
"remove_volumes": false,
"restarted": false,
"scale": null,
"services": null,
"ssl_version": null,
"state": "present",
"stopped": true,
"timeout": 10,
"tls": false,
"tls_hostname": null,
"use_ssh_client": false,
"validate_certs": 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 ubuntu'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'"
}