haxorof/ansible-role-docker-ce

The recent changes to postinstall breaks custom pip install

janorn opened this issue · 14 comments

janorn commented

when:
- docker_network_access | bool
- (docker_sdk | bool) or (docker_stack | bool) or (docker_compose | bool)

janorn commented

I.e running with the version 5.0 with these parameters will not trigger postinstall.

docker_additional_packages_pip
docker_additional_packages_os
docker_x_skip_pip_auto_upgrade

I install the docker python module using this instead of forcing pip upgrades.

janorn commented

Could we perhaps have a or (docker_postinstall | bool)?

Hmm that is not really the intention to use it like that but can you tell me exactly what you specify in those variables?

janorn commented
docker_additional_packages_pip:
  - certifi{{ '==2021.10.8' if ansible_python_version is version('3', '<') else '' }}
  - requests{{ '<2.28,>=2.14.2' if ansible_python_version is version('3', '<') else '' }}
  - urllib3{{ '<2' if ansible_python_version is version('3', '<') else '' }}
  - websocket-client{{ '<1' if ansible_python_version is version('3', '<') else '' }}
  - docker{{ '<5' if ansible_python_version is version('3', '<') else '' }}

Packages for Centos7

docker_additional_packages_os:
  - python2-pip
  - python-psycopg2
  - python2-backports-shutil_get_terminal_size

For more recent

docker_additional_packages_os:
  - python3-pip
  - python3-psycopg2

What would be the difference if you just skip the line with docker in docker_additional_packages_pip and just set docker_sdk to true?

In the role I have docker{{ '<5' if ansible_python_version is version('3', '<') }} so the result would be the same or?

janorn commented

With the old pip in Centos 7 it will pull wrong versions of the dependencies and fail before it reaches the docker sdk.

I will drop centos 7 soon but unfortunately we still have some old environments.

I want to do a test in the testing I do for this role before deciding on what to do.

For the listed pip packages you earlier provided in the variable, can you give me the versions you see of those when looking at pip freeze?

janorn commented

The uppger limits are set to avoid those.

Okay thanks! I will just have to test this then and see, will do that next week. Just just cannot see right now what really is the problem using docker_sdk since I have the same upper limit as you and do not automatically upgrade the other mentioned pip packages explicitly at least what I can see right now.

janorn commented

But don't you upgrade pip? One more thing though. Some of our servers can't connect to pypi so I mirror the git repos and point the list towards those repos instead don't think that is possible with your sdk option.

It should not do the upgrade if you set the configuration not to do it. What I plan to test next week is the following and I think it would be equal to what you have today:

docker_x_skip_pip_auto_upgrade: yes
docker_pip_upgrade: no
docker_sdk: yes
docker_additional_packages_pip:
  - certifi{{ '==2021.10.8' if ansible_python_version is version('3', '<') else '' }}
  - requests{{ '<2.28,>=2.14.2' if ansible_python_version is version('3', '<') else '' }}
  - urllib3{{ '<2' if ansible_python_version is version('3', '<') else '' }}
  - websocket-client{{ '<1' if ansible_python_version is version('3', '<') else '' }}
docker_additional_packages_os:
  - python2-pip
  - python-psycopg2
  - python2-backports-shutil_get_terminal_size

I tested the configuration in previous comment and noticed that packages that you are specifying are packages that some docker depends on. Therefore the order becomes important here and in my role I installed the additional packages after "docker<5" which then causes the issue where it tries to install requests package for Python 3.7.

I have done a change of the ordering on master now. Could you see if that works for you? If not then just keep using version 4.0.0 on your machine if you do not have a big need for the breaking changes I did in the 5.0.0 version.

If you test what is now on master and it works I can create a bug fix version to be published to galaxy.

janorn commented

I did a quick test and it seems to work for centos 7. Ran into some Ansible-lint issues with rocky9. Need to fix that to be able to validate the whole build pipeline.

Released 5.0.1 so it is available in Ansible galaxy