Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker_compose restarts stopped containers with stopped parameter #532

Closed
tonal opened this issue Jun 18, 2020 · 9 comments · Fixed by #547
Closed

docker_compose restarts stopped containers with stopped parameter #532

tonal opened this issue Jun 18, 2020 · 9 comments · Fixed by #547

Comments

@tonal
Copy link

tonal commented Jun 18, 2020

see original issues: ansible/ansible#69728

COMPONENT NAME

docker_compose

Error:

Unable to load docker-compose. Try `pip install docker-compose`. Error: No module named compose

playbook:

  roles:
  # Install most docker_service dependencies
  - { role: "nickjj.docker", tags: ["docker"] }

  tasks:
  - name: test docker-compose
    docker_service:
      project_src: test

Stack trace:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_docker_service_payload_U2NKy6/__main__.py", line 456, in <module>
    from compose import __version__ as compose_version

fatal: [138.xx.xx.183]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "api_version": "auto",
            "build": false,
            "cacert_path": null,
            "cert_path": null,
            "debug": false,
            "definition": null,
            "dependencies": true,
            "docker_host": "unix://var/run/docker.sock",
            "files": null,
            "hostname_check": false,
            "key_path": null,
            "nocache": false,
            "project_name": null,
            "project_src": "../<...>",
            "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": false,
            "timeout": 10,
            "tls": false,
            "tls_hostname": "localhost",
            "tls_verify": false
        }
    },
    "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: No module named compose"
}

Workaround:

Running pip install docker-compose on the server managed by ansible fixed the issue.

Version infos

galaxy info:

Role: nickjj.docker
	description: Install Docker and optionally Docker Compose.
	active: True
	commit: d498cc15f393312ae9e104e13cc3ac7d07365c8d
	commit_message: Update README to link to the latest release
	commit_url: https://api.github.com/repos/nickjj/ansible-docker/git/commits/d498cc15f393312ae9e104e13cc3ac7d07365c8d
	company: 
	created: 2016-10-08T23:13:50.040014Z
	dependencies: []
	download_count: 2838
	forks_count: 69
	galaxy_info:
		author: Nick Janetakis
		galaxy_tags: ['containers', 'compose', 'docker', 'packaging', 'system']
		license: MIT
		min_ansible_version: 2.5
		platforms: [{'name': 'Ubuntu', 'versions': ['xenial', 'bionic']}, {'name': 'Debian', 'versions': ['jessie', 'stretch']}]
		role_name: docker
	github_branch: master
	github_repo: ansible-docker
	github_user: nickjj
	id: 12606
	imported: 2018-11-08T21:18:19.792556-05:00
	install_date: Thu Nov 15 16:08:42 2018
	intalled_version: v1.5.0
	is_valid: True
	issue_tracker_url: https://github.com/nickjj/ansible-docker/issues
	license: MIT
	min_ansible_version: 2.5
	modified: 2018-11-09T02:18:19.792718Z
	open_issues_count: 0
	path: ['/home/xxx/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
	role_type: ANS
	stargazers_count: 195
	travis_status_url: 

ansible version:

ansible --version
ansible 2.7.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/olivier/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.1 (default, Oct 22 2018, 10:41:28) [GCC 8.2.1 20180831]
@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@tonal: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

click here for bot help

@ansibullbot ansibullbot added affects_2.10 needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly needs_triage python3 traceback labels Jun 18, 2020
@tonal
Copy link
Author

tonal commented Jun 18, 2020

COMPONENT NAME
docker_compose

@tonal
Copy link
Author

tonal commented Jun 18, 2020

!component =/plugins/modules/cloud/docker/docker_compose

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the module module label Jun 18, 2020
@felixfontein
Copy link
Collaborator

!component =plugins/modules/cloud/docker/docker_compose.py

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added cloud docker plugins plugin (any type) and removed needs_triage needs_info This issue requires further information. Please answer any outstanding questions needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly labels Jun 18, 2020
@xoxys
Copy link
Contributor

xoxys commented Jun 20, 2020

I'm a bit confused. IMO this issue and it's description is completely unrelated to the initial issue. Don't know if it would be better to open a new issue, but at the end I run into the same issue as described by the original author of ansible/ansible#69728. For whatever reason the docker_compose module restarts the server even if stopped: yes is set. This also breaks the idempotency of the module and report changed on every run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants