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

pip docker-compose doesn't seems to have the tag "latest" anymore #47

Closed
Platou opened this issue Dec 18, 2018 · 15 comments
Closed

pip docker-compose doesn't seems to have the tag "latest" anymore #47

Platou opened this issue Dec 18, 2018 · 15 comments

Comments

@Platou
Copy link

Platou commented Dec 18, 2018

Installing the role:

  roles:
  - { role: "nickjj.docker", tags: ["docker"] }

Output:

TASK [nickjj.docker : Install Python packages] *********************************
ok: [host] => (item={u'state': u'present', u'name': u'docker'})
failed: [host] (item={u'path': u'/usr/local/bin/docker-compose', u'state': u'present', u'version': u'latest', u'name': u'docker-compose', u'src': u'/usr/local/lib/docker/virtualenv/bin/docker-compose'}) => {"changed": false, "cmd": "/usr/local/lib/docker/virtualenv/bin/pip2 install docker-compose==latest", "item": {"name": "docker-compose", "path": "/usr/local/bin/docker-compose", "src": "/usr/local/lib/docker/virtualenv/bin/docker-compose", "state": "present", "version": "latest"}, "msg": "stdout: Collecting docker-compose==latest\n\n:stderr:   Could not find a version that satisfies the requirement docker-compose==latest (from versions: 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc1, 1.2.0rc2, 1.2.0rc3, 1.2.0rc4, 1.2.0, 1.3.0rc1, 1.3.0rc2, 1.3.0rc3, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.5.0rc1, 1.5.0rc2, 1.5.0rc3, 1.5.0, 1.5.1, 1.5.2, 1.6.0rc1, 1.6.0, 1.6.1, 1.6.2, 1.7.0rc1, 1.7.0rc2, 1.7.0, 1.7.1, 1.8.0rc1, 1.8.0rc2, 1.8.0, 1.8.1, 1.9.0rc1, 1.9.0rc2, 1.9.0rc3, 1.9.0rc4, 1.9.0, 1.10.0rc1, 1.10.0rc2, 1.10.0, 1.10.1, 1.11.0rc1, 1.11.0, 1.11.1, 1.11.2, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.13.0rc1, 1.13.0, 1.14.0rc1, 1.14.0rc2, 1.14.0, 1.15.0rc1, 1.15.0, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.17.0rc1, 1.17.0, 1.17.1, 1.18.0rc1, 1.18.0rc2, 1.18.0, 1.19.0rc1, 1.19.0rc2, 1.19.0rc3, 1.19.0, 1.20.0rc1, 1.20.0rc2, 1.20.0, 1.20.1, 1.21.0rc1, 1.21.0, 1.21.1, 1.21.2, 1.22.0rc1, 1.22.0rc2, 1.22.0, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2)\nNo matching distribution found for docker-compose==latest\n"}
@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

What type of environment are you running this under?

On Ubuntu 16.04, Ubuntu 18.04 and Debian Stretch it installs on a fresh box using version "latest" with state "present".

@Platou
Copy link
Author

Platou commented Dec 18, 2018

Microsoft Azure : Canonical, UbuntuServer, 18.04-LTS, latest

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Here's what I used for testing where everything ran successfully:

  • Set up those 3 distros using Docker images
  • Created a stock Ubuntu 18.04 VM using the server ISO on Ubuntu's site
  • Set up a brand new DigitalOcean 18.04 server

In all 3 cases, the role ran to completion and installed the latest version of Docker and Docker Compose.

In all 3 cases, I ran apt-get update -y && apt-get install -y python before this role since that's required for Ansible to run. This is a common bootstrap strategy.

What happens if you add that to a pre_tasks in your playbook?

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Here's a complete task you can drop in:

- name: Install Python without using Ansible modules
  raw: >
    bash -c "test -e /usr/bin/python \
    || (apt-get -qy update && apt-get install -qy python)"
  changed_when: false

It's using raw since this is meant to be ran before Ansible is even capable of being run.

@Platou
Copy link
Author

Platou commented Dec 18, 2018

Here's my playbook:

- hosts: "host"
  become: true
  become_method: sudo

  roles:
  - { role: "nickjj.docker", tags: ["docker"] }

  pre_tasks:
  - name: Install python 2
    raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Does anything change if you use python instead of python-minimal?

@Platou
Copy link
Author

Platou commented Dec 18, 2018

Same error with python instead of python-minimal

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

You could try adding this after the - name: Install Virtualenv task:

- name: Upgrade PIP
  pip:
    name: "pip"
    virtualenv: "{{ docker__pip_virtualenv }}"
    state: "forcereinstall"

Truthfully I'm not sure why that would be needed on Azure, but it's worth trying.

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Also what version of Ansible are you using? Maybe the pip package changed in some way to automatically convert latest to being omit. I'm running 2.7.5.

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Another thing you could try is setting docker__compose_version: "". Let me know if that installs the latest version without erroring out. If it does, that's likely something I should merge into the next release.

@Platou
Copy link
Author

Platou commented Dec 18, 2018

I'm using Ansible 2.5.1

@Platou
Copy link
Author

Platou commented Dec 18, 2018

Working fine with Ansible 2.7.5

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Thanks. Did you happen to try "" with 2.5.1?

@nickjj
Copy link
Owner

nickjj commented Dec 18, 2018

Going by some PR I read I think "" will fail with 2.5.1 too.

I think any version that's not parseable as a version is getting cast to "" and in 2.5.x, "" gets passed into pip like pip install docker-compose=="" (which is invalid) but with 2.7.x it gets set as pip install docker-compose because Ansible doesn't set the version for empty strings.

I'll leave this issue open until I address a solution that works for both 2.5.x and 2.7.x, thanks for the heads up.

@nickjj
Copy link
Owner

nickjj commented Dec 19, 2018

Closing this. It's been addressed in v1.8.0 which is available in the Galaxy. The role is back to working with Ansible 2.5 and 2.7.

@nickjj nickjj closed this as completed Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants