haxorof / ansible-role-docker-ce

Ansible role to install Docker CE on AlmaLinux/Rocky/CentOS Stream/Fedora/RHEL/Ubuntu/Debian/Mint/Raspbian
MIT License
86 stars 39 forks source link

CentOS 7: "Fetch install PiP version" task throws "ImportError: No module named typing" #137

Closed jamiejackson closed 3 years ago

jamiejackson commented 3 years ago

Version Information

Ansible: 2.10.4

Role: haxorof.docker_ce (3.3.2)

OS: CentOS Linux release 7.6.1810 (Core)

Steps to Reproduce

Ran with:

docker_sdk: true
docker_compose: true

Expected Behavior

Run with no errors

Actual Behavior

TASK [haxorof.docker_ce : Fetch install PiP version] *******************************************************************************************************************************************************************************************************************************************
fatal: [hudx_idis_sync]: FAILED! => {"changed": false, "cmd": ["pip", "--version"], "delta": "0:00:00.048918", "end": "2021-06-22 18:30:13.395986", "msg": "non-zero return code", "rc": 1, "start": "2021-06-22 18:30:13.347068", "stderr": "Traceback (most recent call last):\n  File \"/bin/pip\", line 9, in <module>\n    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 378, in load_entry_point\n    return get_distribution(dist).load_entry_point(group, name)\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2566, in load_entry_point\n    return ep.load()\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2260, in load\n    entry = __import__(self.module_name, globals(),globals(), ['__name__'])\n  File \"/usr/lib/python2.7/site-packages/pip/__init__.py\", line 1, in <module>\n    from typing import List, Optional\nImportError: No module named typing", "stderr_lines": ["Traceback (most recent call last):", "  File \"/bin/pip\", line 9, in <module>", "    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 378, in load_entry_point", "    return get_distribution(dist).load_entry_point(group, name)", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2566, in load_entry_point", "    return ep.load()", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2260, in load", "    entry = __import__(self.module_name, globals(),globals(), ['__name__'])", "  File \"/usr/lib/python2.7/site-packages/pip/__init__.py\", line 1, in <module>", "    from typing import List, Optional", "ImportError: No module named typing"], "stdout": "", "stdout_lines": []}

This may end up just being a python 3 vs 2 thing.

FYI, this is my first time trying the docker-compose part of the role. I hadn't been able to find a combination of roles that enabled both docker-compose and ansible docker modules to work so here I am trying it the haxorof way.

jamiejackson commented 3 years ago

I ran this as an attempted fix:

sudo yum install python-typing

Which led to this:

TASK [haxorof.docker_ce : Postinstall tasks] ***************************************************************************************************************************************************************************************************************************************************
included: /Users/jjackson/projects/hudx/hudx/infrastructure/ansible/roles/haxorof.docker_ce/tasks/postinstall.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Reset internal variables for additional packages to be installed] ****************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker SDK for Python] **************************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker Compose] *********************************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker Stack dependencies ('docker_stack')] *****************************************************************************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts with additional package to be installed] *******************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact for path test of pip/pip3] **********************************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Determine if pip/pip3 exists in path] ********************************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact to install Python 2 PiP and build dependencies] *************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact to install Python 3 PiP and build dependencies] *************************************************************************************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure python-pip-whl is present (Debian 8)] *************************************************************************************************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure python-backports.ssl-match-hostname is present (Debian 10)] ***************************************************************************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure EPEL release repository is installed] *************************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Install additional packages (OS package manager)] ********************************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync] => (item=['python-devel', 'openssl-devel'])

TASK [haxorof.docker_ce : Fetch install PiP version] *******************************************************************************************************************************************************************************************************************************************
fatal: [hudx_idis_sync]: FAILED! => {"changed": false, "cmd": ["pip", "--version"], "delta": "0:00:00.080987", "end": "2021-06-22 18:41:16.902744", "msg": "non-zero return code", "rc": 1, "start": "2021-06-22 18:41:16.821757", "stderr": "Traceback (most recent call last):\n  File \"/bin/pip\", line 9, in <module>\n    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 378, in load_entry_point\n    return get_distribution(dist).load_entry_point(group, name)\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2566, in load_entry_point\n    return ep.load()\n  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2260, in load\n    entry = __import__(self.module_name, globals(),globals(), ['__name__'])\n  File \"/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py\", line 58\n    sys.stderr.write(f\"ERROR: {exc}\")\n                                   ^\nSyntaxError: invalid syntax", "stderr_lines": ["Traceback (most recent call last):", "  File \"/bin/pip\", line 9, in <module>", "    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 378, in load_entry_point", "    return get_distribution(dist).load_entry_point(group, name)", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2566, in load_entry_point", "    return ep.load()", "  File \"/usr/lib/python2.7/site-packages/pkg_resources.py\", line 2260, in load", "    entry = __import__(self.module_name, globals(),globals(), ['__name__'])", "  File \"/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py\", line 58", "    sys.stderr.write(f\"ERROR: {exc}\")", "                                   ^", "SyntaxError: invalid syntax"], "stdout": "", "stdout_lines": []}

Refs:

jamiejackson commented 3 years ago

This is interesting:

[ansible@pdceethudx1 ~]$ pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 58
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax
jamiejackson commented 3 years ago

Okay, so the role is corrupting pip somehow. I ran the following, which got pip --version working again:

$ sudo yum remove python-pip
...
$ sudo yum install python-pip
...
Running transaction
  Installing : python2-pip-8.1.2-14.el7.noarch                                                                                                                                                                                                                                              1/1
  Verifying  : python2-pip-8.1.2-14.el7.noarch
...
$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

Then I ran the role again, which executed:

TASK [haxorof.docker_ce : Set PiP to be upgraded due to too old PiP version (< 9.0.0)] *********************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Upgrade/Reinstall PiP] ***********************************************************************************************************************************************************************************************************************************************
changed: [hudx_idis_sync]

And then the fetch task failed in the same way again.

And CLI fails again, too.

Presumably, something is wrong with the Upgrade/Reinstall PiP task.

haxorof commented 3 years ago

This is interesting:

[ansible@pdceethudx1 ~]$ pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 58
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

This error you get is because you have upgraded pip to version 21 or later. This unfortunately corrupts the pip installation in CentOS 7 so I added in this role to not do that upgrade to 21 (#134). Here is the part that ensure PiP is not being upgraded to 21: https://github.com/haxorof/ansible-role-docker-ce/blob/master/tasks/postinstall.yml#L143-L149

I do not see execution result of task " Ensure PiP upgrade for Python 2 only is upgraded to at most 20.3" because if that is skipped then I can understand it is upgrading to version 21.

@jamiejackson : Did you only ran with the two variables you mentioned or did you set more? I recently ran an integration test and it worked on CentOS 7 but did not get the same result as you. Here are the tests related to docker SDK etc I do: https://github.com/haxorof/ansible-role-docker-ce/blob/master/tests/test_postinstall.yml

Cheers!

haxorof commented 3 years ago

I did a test on CentOS 7 now where PiP was installed using package python-pip before role was run and also without it being installed so that the role will install it when needed. Conclusion is that it works as expected and the relevant task output are seen below:

...
TASK [haxorof.docker_ce : Install additional packages (OS package manager)] ****
Wednesday 23 June 2021  09:04:37 +0000 (0:00:02.386)       0:02:17.938 ********
changed: [test-host] => (item=['python-devel', 'openssl-devel'])

TASK [haxorof.docker_ce : Fetch install PiP version] ***************************
Wednesday 23 June 2021  09:04:52 +0000 (0:00:15.334)       0:02:33.273 ********
ok: [test-host]

TASK [haxorof.docker_ce : Set PiP to be upgraded due to too old PiP version (< 9.0.0)] ***
Wednesday 23 June 2021  09:04:54 +0000 (0:00:02.362)       0:02:35.635 ********
ok: [test-host]

TASK [haxorof.docker_ce : Set PiP to be upgraded due to Rust depencency for cryptography] ***
Wednesday 23 June 2021  09:04:55 +0000 (0:00:00.043)       0:02:35.678 ********
skipping: [test-host]

TASK [haxorof.docker_ce : Ensure PiP upgrade for Python 2 only is upgraded to at most 20.3] ***
Wednesday 23 June 2021  09:04:55 +0000 (0:00:00.030)       0:02:35.709 ********
ok: [test-host]

TASK [haxorof.docker_ce : Upgrade/Reinstall PiP] *******************************
Wednesday 23 June 2021  09:04:55 +0000 (0:00:00.035)       0:02:35.744 ********
changed: [test-host]

TASK [haxorof.docker_ce : Install additional packages (PiP)] *******************
Wednesday 23 June 2021  09:04:59 +0000 (0:00:04.651)       0:02:40.395 ********
changed: [test-host] => (item=docker<5)
changed: [test-host] => (item=docker-compose<1.29)
changed: [test-host] => (item=jsondiff)
ok: [test-host] => (item=pyyaml)
....

Most important task is the one that ensure PiP is kept below version 21.

Playbook used was:

- name: Test using PiP to install SDK, compose and stack
  hosts: test-host
  vars:
    docker_users:
      - vagrant
    docker_sdk: true
    docker_compose: true
    docker_stack: true
  roles:
    - haxorof.docker_ce
jamiejackson commented 3 years ago

Here are the effective docker_* vars for this host:

        "docker_compose": true,
        "docker_compose_ver": "1.26.2",
        "docker_daemon_config": {
            "bip": "172.17.0.1/16",
            "debug": false,
            "experimental": true,
            "features": {
                "buildkit": true
            },
            "icc": false,
            "init": true,
            "live-restore": false,
            "log-driver": "json-file",
            "log-opts": {
                "compress": "true",
                "max-file": "5",
                "max-size": "50m"
            },
            "storage-driver": "overlay2",
            "userland-proxy": false
        },
        "docker_enable_audit": true,
        "docker_enable_ce_edge": false,
        "docker_enable_mount_flag_fix": false,
        "docker_enable_swarm": true,
        "docker_sdk": true,
        "docker_swarm": {
            "advertise_nic": "eth0"
        },
        "docker_users": [
            REDACTED
        ],
        "docker_version": "",
jamiejackson commented 3 years ago

Let me know if you have any recommendations as to how to get past these issues.

haxorof commented 3 years ago

Thanks!

When you run your playbook. What does it say for task “Ensure PiP upgrade for Python 2 only is upgraded to at most 20.3“?

jamiejackson commented 3 years ago

That's several tasks after the error, as far as I know, so I haven't gotten there yet.

Thanks for the responses so far, BTW.

haxorof commented 3 years ago

That's several tasks after the error, as far as I know, so I haven't gotten there yet.

Thanks for the responses so far, BTW.

I assume you are then talking about the initial failure happening in task Fetch install PiP version? If that is the case then the only way to fix that is to run yum reinstall python-pip manually since it is not possible to downgrade from PiP version 21 in an good way more than just to reinstall pip.

When you previously did that reinstall of python-pip then you ran and wrote this output:

TASK [haxorof.docker_ce : Set PiP to be upgraded due to too old PiP version (< 9.0.0)] *********************************************************************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Upgrade/Reinstall PiP] ***********************************************************************************************************************************************************************************************************************************************
changed: [hudx_idis_sync]

The task Ensure PiP upgrade for Python 2 only is upgraded to at most 20.3 shall run just before Upgrade/Reinstall PiP. For me this point to that you are not using the latest version (3.3.2) but using version 3.2.1.

Please verify the role version you use because it seems you are using an older version of the role.

Thanks!

jamiejackson commented 3 years ago

I've just now done an rm -rf ~/.ansible/ to make sure everything is fresh. Then I reinstalled roles.

 % ansible-galaxy role list
[DEPRECATION WARNING]: DEFAULT_HASH_BEHAVIOUR option, this feature is fragile and not portable, leading to continual confusion and misuse, use the ``combine`` filter explicitly instead.
This feature will be removed from ansible-base in version 2.13. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
# /Users/jjackson/.ansible/roles
- franklinkim.docker-compose, 1.2.2
- geerlingguy.java, 1.10.0
- ansible-role-docker-ce-jj, redhat_tweaks
- geerlingguy.docker, 2.1.0
- geerlingguy.repo-epel, 3.0.0
- geerlingguy.pip, 1.3.0
- geerlingguy.ntp, 2.2.0
- geerlingguy.aws-inspector, 1.1.0
- haxorof.docker_ce, 3.3.2
- jtyr.grub_cmdline, master
- andrewrothstein.docker-compose, v1.3.10
- andrewrothstein.bash, v1.1.1

The following happens whether I begin with python-pip yum-removed or whether I have it yum-installed:

TASK [haxorof.docker_ce : Collect distribution facts if not already done] ********************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set distribution and python facts] *********************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Reinterpret distribution facts for Linux Mint 18] ******************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Reinterpret distribution facts for Debian 10 (Buster) due to bug] **************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : OS release info] ***************************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Print OS release information] **************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Print LSB information] *********************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Reinterpret distribution facts for Raspbian] ***********************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Reset role variables] **********************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Print interpreted distribution information] ************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Compatibility and distribution checks] *****************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/checks.yml for hudx_idis_sync

TASK [haxorof.docker_ce : include_tasks] *****************************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/checks/distribution-checks.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Fail if this role does not support the distribution] ***************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Fail if kernel version is lower than 3.10] *************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Fail if unsupported version for distribution] **********************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : include_tasks] *****************************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/checks/compatibility-checks.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Compatibility check - Fail if both MountFlags=slave and live-restore are set] **************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Network access disabled] *******************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Remove Docker versions before Docker CE] ***************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Setup Docker package repositories] *********************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/setup-repository.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Include tasks for distribution variety RedHat to setup repository] *************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/setup-repository-RedHat.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Ensure python and deps for Ansible modules] ************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure packages are installed for repository setup] ****************************************************************************************************************
ok: [hudx_idis_sync] => (item=yum-utils)

TASK [haxorof.docker_ce : Determine channels to be enabled and/or disabled] ******************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Add Docker CE repository] ******************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Fetch $relesever value] ********************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Replace $releasever with '7' in /etc/yum.repos.d/docker-ce.repo] ***************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Disable Docker CE repository channels] *****************************************************************************************************************************
ok: [hudx_idis_sync] => (item=nightly)
ok: [hudx_idis_sync] => (item=test)

TASK [haxorof.docker_ce : Enable Docker CE repository channels] ******************************************************************************************************************************
ok: [hudx_idis_sync] => (item=stable)

TASK [haxorof.docker_ce : Set internal facts for repository handling] ************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Enable and disable repositories (RedHat)] **************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Update repository cache] *******************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Install Docker] ****************************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/install-docker.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Set version string] ************************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set packages state to latest] **************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Filter out packages to match older Docker CE versions] *************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure some kind of compatibility for no longer officially supported distributions since Docker CE 18.09] **********************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Do workaround to handle CentOS/RHEL 8 installation issues] *********************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure Docker CE is installed] *************************************************************************************************************************************
ok: [hudx_idis_sync] => (item=docker-ce-cli)
ok: [hudx_idis_sync] => (item=docker-ce)
ok: [hudx_idis_sync] => (item=containerd.io)

TASK [haxorof.docker_ce : Configure audit logging] *******************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/setup-audit.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Ensure auditd is installed] ****************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Copy Docker audit rules] *******************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure Docker audit rules are removed] *****************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Apply workarounds for bugs and/or tweaks] **************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/bug-tweaks.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Configuration to avoid 'Device or resource busy' (CentOS/RedHat)] **************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/bug-tweaks/bug-centos7-resource-busy.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Stat /proc/sys/fs/may_detach_mounts (CentOS/RedHat)] ***************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure fs.may_detach_mounts is set to avoid 'Device or resource busy' (CentOS/RedHat)] *****************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Stat /etc/sysctl.d/99-docker.conf (CentOS/RedHat)] *****************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Unset fs.may_detach_mounts (CentOS/RedHat)] ************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Remove systemd drop-in for Docker Mount Flags slave configuration (CentOS/RedHat)] *********************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set MountFlags option to "slave" to prevent "device busy" errors on CentOS/RedHat 7.3 kernels (CentOS/RedHat)] *****************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Best effort handling to directlvm for Debian 8 to get uniform behavior across distributions] ***********************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Configure Docker] **************************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/configure-docker.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Determine usage of systemd] ****************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact to indicate systemd is used or not] ***********************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Configure systemd service] *****************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/configure-docker/configure-systemd.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Combine all systemd service configuration options] *****************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure /etc/systemd/system/docker.service.d directory exists] ******************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Setup default Docker drop-in to enable use of environment file] ****************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Combine Docker daemon environment variable configuration] **********************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Setup Docker environment file /etc/sysconfig/docker-envs] **********************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Force daemon reload of systemd] ************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Configure non-systemd service] *************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure /etc/docker directory exists] *******************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Configure Docker daemon (file)] ************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Configure Docker daemon (variables)] *******************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure Docker default user namespace is defined in subuid and subgid] **********************************************************************************************
skipping: [hudx_idis_sync] => (item=/etc/subuid)
skipping: [hudx_idis_sync] => (item=/etc/subgid)

TASK [haxorof.docker_ce : Ensure Docker users are added to the docker group] *****************************************************************************************************************
ok: [hudx_idis_sync] => (item=REDACTED)
ok: [hudx_idis_sync] => (item=REDACTED)
ok: [hudx_idis_sync] => (item=REDACTED)

TASK [haxorof.docker_ce : Ensure lvm2 is installed] ******************************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure thin-provisioning-tools is installed] ***********************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Enable Docker service] *********************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Trigger start/restart of Docker] ***********************************************************************************************************************************
changed: [hudx_idis_sync] => {
    "msg": "Notify handler to start/restart docker"
}

TASK [haxorof.docker_ce : Install and configure Docker plugins] ******************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Postinstall tasks] *************************************************************************************************************************************************
included: /Users/jjackson/.ansible/roles/haxorof.docker_ce/tasks/postinstall.yml for hudx_idis_sync

TASK [haxorof.docker_ce : Reset internal variables for additional packages to be installed] **************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker SDK for Python] ************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker Compose] *******************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts to install Docker Stack dependencies ('docker_stack')] ***************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set facts with additional package to be installed] *****************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact for path test of pip/pip3] ********************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Determine if pip/pip3 exists in path] ******************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact to install Python 2 PiP and build dependencies] ***********************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fact to install Python 3 PiP and build dependencies] ***********************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure python-pip-whl is present (Debian 8)] ***********************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure python-backports.ssl-match-hostname is present (Debian 10)] *************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure EPEL release repository is installed] ***********************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Install additional packages (OS package manager)] ******************************************************************************************************************
ok: [hudx_idis_sync] => (item=['python-devel', 'openssl-devel'])

TASK [haxorof.docker_ce : Fetch install PiP version] *****************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set PiP to be upgraded due to too old PiP version (< 9.0.0)] *******************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set PiP to be upgraded due to Rust depencency for cryptography] ****************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Ensure PiP upgrade for Python 2 only is upgraded to at most 20.3] **************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Upgrade/Reinstall PiP] *********************************************************************************************************************************************
changed: [hudx_idis_sync]

TASK [haxorof.docker_ce : Install additional packages (PiP)] *********************************************************************************************************************************
FAILED - RETRYING: Install additional packages (PiP) (3 retries left).
FAILED - RETRYING: Install additional packages (PiP) (2 retries left).
FAILED - RETRYING: Install additional packages (PiP) (1 retries left).
failed: [hudx_idis_sync] (item=docker<5) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "cmd": ["/bin/pip2", "install", "docker<5"], "item": "docker<5", "msg": "stdout: Collecting docker<5\n  Using cached docker-4.4.4-py2.py3-none-any.whl (147 kB)\nRequirement already satisfied: six>=1.4.0 in /usr/lib/python2.7/site-packages (from docker<5) (1.9.0)\nCollecting requests!=2.18.0,>=2.14.2\n  Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)\nCollecting websocket-client>=0.32.0\n  Using cached websocket_client-0.59.0-py2.py3-none-any.whl (67 kB)\nRequirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < \"3.5\" in /usr/lib/python2.7/site-packages (from docker<5) (3.5.0.1)\nRequirement already satisfied: ipaddress>=1.0.16; python_version < \"3.3\" in /usr/lib/python2.7/site-packages (from docker<5) (1.0.16)\nRequirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker<5) (4.0.0)\nRequirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker<5) (1.26.5)\nRequirement already satisfied: idna<3,>=2.5 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker<5) (2.10)\nRequirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests!=2.18.0,>=2.14.2->docker<5) (2021.5.30)\nInstalling collected packages: requests, websocket-client, docker\n  Attempting uninstall: requests\n    Found existing installation: requests 2.6.0\n\n:stderr: ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n"}
FAILED - RETRYING: Install additional packages (PiP) (3 retries left).
FAILED - RETRYING: Install additional packages (PiP) (2 retries left).
FAILED - RETRYING: Install additional packages (PiP) (1 retries left).
failed: [hudx_idis_sync] (item=docker-compose<1.29) => {"ansible_loop_var": "item", "attempts": 3, "changed": false, "cmd": ["/bin/pip2", "install", "docker-compose<1.29"], "item": "docker-compose<1.29", "msg": "stdout: Collecting docker-compose<1.29\n  Using cached docker_compose-1.26.2-py2.py3-none-any.whl (139 kB)\nRequirement already satisfied: subprocess32<4,>=3.5.4; python_version < \"3.2\" in /usr/lib64/python2.7/site-packages (from docker-compose<1.29) (3.5.4)\nRequirement already satisfied: texttable<2,>=0.9.0 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (1.6.3)\nCollecting requests<3,>=2.20.0\n  Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)\nCollecting websocket-client<1,>=0.32.0\n  Using cached websocket_client-0.59.0-py2.py3-none-any.whl (67 kB)\nCollecting jsonschema<4,>=2.5.1\n  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)\nCollecting docker[ssh]<5,>=4.2.2\n  Using cached docker-4.4.4-py2.py3-none-any.whl (147 kB)\nCollecting distro<2,>=1.5.0\n  Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB)\nRequirement already satisfied: ipaddress<2,>=1.0.16; python_version < \"3.3\" in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (1.0.16)\nRequirement already satisfied: backports.ssl-match-hostname<4,>=3.5; python_version < \"3.5\" in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (3.5.0.1)\nCollecting docopt<1,>=0.6.1\n  Using cached docopt-0.6.2.tar.gz (25 kB)\nCollecting dockerpty<1,>=0.4.1\n  Using cached dockerpty-0.4.1.tar.gz (13 kB)\nCollecting cached-property<2,>=1.2.0\n  Using cached cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)\nRequirement already satisfied: PyYAML<6,>=3.10 in /usr/lib64/python2.7/site-packages (from docker-compose<1.29) (3.10)\nCollecting python-dotenv<1,>=0.13.0\n  Using cached python_dotenv-0.18.0-py2.py3-none-any.whl (18 kB)\nCollecting enum34<2,>=1.0.4; python_version < \"3.4\"\n  Using cached enum34-1.1.10-py2-none-any.whl (11 kB)\nRequirement already satisfied: six<2,>=1.3.0 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (1.9.0)\nCollecting backports.shutil-get-terminal-size==1.0.0; python_version < \"3.3\"\n  Using cached backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl (6.5 kB)\nRequirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (4.0.0)\nRequirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (1.26.5)\nRequirement already satisfied: idna<3,>=2.5 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (2.10)\nRequirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (2021.5.30)\nRequirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from jsonschema<4,>=2.5.1->docker-compose<1.29) (0.9.8)\nCollecting functools32; python_version < \"3\"\n  Using cached functools32-3.2.3-2.tar.gz (31 kB)\nCollecting pyrsistent>=0.14.0\n  Using cached pyrsistent-0.16.1.tar.gz (108 kB)\nCollecting attrs>=17.4.0\n  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)\nCollecting importlib-metadata; python_version < \"3.8\"\n  Using cached importlib_metadata-2.1.1-py2.py3-none-any.whl (10 kB)\nCollecting paramiko>=2.4.2; extra == \"ssh\"\n  Using cached paramiko-2.7.2-py2.py3-none-any.whl (206 kB)\nRequirement already satisfied: typing; python_version < \"3.5\" in /usr/lib/python2.7/site-packages (from python-dotenv<1,>=0.13.0->docker-compose<1.29) (3.5.2.2)\nCollecting contextlib2; python_version < \"3\"\n  Using cached contextlib2-0.6.0.post1-py2.py3-none-any.whl (9.8 kB)\nCollecting pathlib2; python_version < \"3\"\n  Using cached pathlib2-2.3.5-py2.py3-none-any.whl (18 kB)\nCollecting zipp>=0.5\n  Using cached zipp-1.2.0-py2.py3-none-any.whl (4.8 kB)\nCollecting configparser>=3.5; python_version < \"3\"\n  Using cached configparser-4.0.2-py2.py3-none-any.whl (22 kB)\nCollecting cryptography>=2.5\n  Using cached cryptography-3.3.2-cp27-cp27mu-manylinux2010_x86_64.whl (2.6 MB)\nCollecting pynacl>=1.0.1\n  Using cached PyNaCl-1.4.0-cp27-cp27mu-manylinux1_x86_64.whl (964 kB)\nCollecting bcrypt>=3.1.3\n  Using cached bcrypt-3.1.7-cp27-cp27mu-manylinux1_x86_64.whl (59 kB)\nCollecting scandir; python_version < \"3.5\"\n  Using cached scandir-1.10.0.tar.gz (33 kB)\nCollecting cffi>=1.12\n  Using cached cffi-1.14.5-cp27-cp27mu-manylinux1_x86_64.whl (389 kB)\nCollecting pycparser\n  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)\nUsing legacy 'setup.py install' for docopt, since package 'wheel' is not installed.\nUsing legacy 'setup.py install' for dockerpty, since package 'wheel' is not installed.\nUsing legacy 'setup.py install' for functools32, since package 'wheel' is not installed.\nUsing legacy 'setup.py install' for pyrsistent, since package 'wheel' is not installed.\nUsing legacy 'setup.py install' for scandir, since package 'wheel' is not installed.\nInstalling collected packages: requests, websocket-client, functools32, pyrsistent, attrs, contextlib2, scandir, pathlib2, zipp, configparser, importlib-metadata, jsonschema, pycparser, cffi, enum34, cryptography, pynacl, bcrypt, paramiko, docker, distro, docopt, dockerpty, cached-property, python-dotenv, backports.shutil-get-terminal-size, docker-compose\n  Attempting uninstall: requests\n    Found existing installation: requests 2.6.0\n\n:stderr: ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n"}

RUNNING HANDLER [haxorof.docker_ce : restart docker] *****************************************************************************************************************************************

PLAY RECAP ***********************************************************************************************************************************************************************************
hudx_idis_sync             : ok=56   changed=2    unreachable=0    failed=1    skipped=39   rescued=0    ignored=0
jamiejackson commented 3 years ago

I just did an experiment where I added a variable to my config:

docker_pip_extra_args: --ignore-installed requests

Which seemed to work around the problem:

TASK [haxorof.docker_ce : Install additional packages (PiP)] *********************************************************************************************************************************
changed: [hudx_idis_sync] => (item=docker<5)
changed: [hudx_idis_sync] => (item=docker-compose<1.29)

TASK [haxorof.docker_ce : Test if module ssl_match_hostname exists] **************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Apply workaround for issue - No module named ssl_match_hostname (Python 2.7)] **************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Test if module shutil_get_terminal_size exists] ********************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Apply workaround for issue - No module named shutil_get_terminal_size (Python 2.7)] ********************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Stat /usr/bin/docker-compose] **************************************************************************************************************************************
ok: [hudx_idis_sync]

TASK [haxorof.docker_ce : Get latest release of docker-compose] ******************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set detected docker-compose version] *******************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set fixed docker-compose version] **********************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Fetch docker-compose SHA265 sum file] ******************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Dump SHA256 file contents to variable] *****************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Remove temporary file for SHA256 sum] ******************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Set SHA256 facts related to docker-compose] ************************************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Install docker-compose {{ _docker_compose_version }} (Linux)] ******************************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Create symlink for docker-compose to work with sudo in some distributions] *****************************************************************************************
skipping: [hudx_idis_sync]

TASK [haxorof.docker_ce : Remove Docker CE and related configuration] ************************************************************************************************************************
skipping: [hudx_idis_sync]

...
haxorof commented 3 years ago

Thanks for doing the reinstall of all your roles which made sure you got the right version. Based on the output now it looks good and upgrade is done correctly in regards to pip.

The problem you got with requests indicates that something has been installing that before this role in some way or something that remained after your attempts to install docker-compose etc.

If you have a clean and minimal installation of CentOS 7 everything works fine since then requests is not even installed. So below I show you how it looks in a systems where this docker role works without any issues just before it starting to install docker-compose using pip (I just installed python-devel and openssl-devel with yum as what the role do):

[root@centos7 ~]# yum list installed | grep python
dbus-python.x86_64                      1.1.1-9.el7                    @anaconda
libselinux-python.x86_64                2.5-15.el7                     @anaconda
libxml2-python.x86_64                   2.9.1-6.el7.5                  @base
newt-python.x86_64                      0.52.15-4.el7                  @anaconda
python.x86_64                           2.7.5-90.el7                   @updates
python-backports.x86_64                 1.0-8.el7                      @base
python-backports-ssl_match_hostname.noarch
python-chardet.noarch                   2.2.1-3.el7                    @base
python-configobj.noarch                 4.7.2-7.el7                    @anaconda
python-decorator.noarch                 3.4.0-3.el7                    @anaconda
python-devel.x86_64                     2.7.5-90.el7                   @updates
python-firewall.noarch                  0.6.3-13.el7_9                 @updates
python-gobject-base.x86_64              3.22.0-1.el7_4.1               @anaconda
python-iniparse.noarch                  0.4-9.el7                      @anaconda
python-ipaddress.noarch                 1.0.16-2.el7                   @base
python-kitchen.noarch                   1.1.1-5.el7                    @base
python-libs.x86_64                      2.7.5-90.el7                   @updates
python-linux-procfs.noarch              0.4.11-4.el7                   @anaconda
python-perf.x86_64                      3.10.0-1160.31.1.el7           @updates
python-pycurl.x86_64                    7.19.0-19.el7                  @anaconda
python-pyudev.noarch                    0.15-9.el7                     @anaconda
python-rpm-macros.noarch                3-34.el7                       @base
python-schedutils.x86_64                0.4-6.el7                      @anaconda
python-setuptools.noarch                0.9.8-7.el7                    @base
python-slip.noarch                      0.4.0-4.el7                    @anaconda
python-slip-dbus.noarch                 0.4.0-4.el7                    @anaconda
python-srpm-macros.noarch               3-34.el7                       @base
python-urlgrabber.noarch                3.10-10.el7                    @anaconda
python2-pip.noarch                      8.1.2-14.el7                   @epel
python2-rpm-macros.noarch               3-34.el7                       @base
rpm-python.x86_64                       4.11.3-45.el7                  @anaconda

[root@centos7 ~]# pip freeze
backports.ssl-match-hostname==3.5.0.1
chardet==2.2.1
configobj==4.7.2
decorator==3.4.0
iniparse==0.4
ipaddress==1.0.16
kitchen==1.1.1
perf==0.1
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
pyliblzma==0.5.3
python-linux-procfs==0.4.9
pyudev==0.15
pyxattr==0.5.1
schedutils==0.4
slip==0.4.0
slip.dbus==0.4.0
urlgrabber==3.10
yum-metadata-parser==1.1.4
You are using pip version 8.1.2, however version 21.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

And here below I do the installation as the role would do it:

[root@centos7 ~]# pip2 install -U "pip<21"
Collecting pip<21
  Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 1.1MB/s
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-20.3.4
You are using pip version 20.3.4, however version 21.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

[root@centos7 ~]# pip2 install "docker<5"
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.    
Collecting docker<5
  Downloading docker-4.4.4-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 9.6 MB/s
Collecting six>=1.4.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting requests!=2.18.0,>=2.14.2
  Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 9.5 MB/s
Collecting websocket-client>=0.32.0
  Downloading websocket_client-0.59.0-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 9.3 MB/s
Requirement already satisfied: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker<5) (3.5.0.1)
Requirement already satisfied: ipaddress>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/site-packages (from docker<5) (1.0.16)
Collecting chardet<5,>=3.0.2
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 29.5 MB/s
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.5-py2.py3-none-any.whl (138 kB)
     |████████████████████████████████| 138 kB 31.6 MB/s
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 13.9 MB/s
Collecting certifi>=2017.4.17
  Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 23.0 MB/s
Installing collected packages: six, chardet, urllib3, idna, certifi, requests, websocket-client, docker
  Attempting uninstall: chardet
    Found existing installation: chardet 2.2.1
    Uninstalling chardet-2.2.1:
      Successfully uninstalled chardet-2.2.1
Successfully installed certifi-2021.5.30 chardet-4.0.0 docker-4.4.4 idna-2.10 requests-2.25.1 six-1.16.0 urllib3-1.26.5 websocket-client-0.59.0

[root@centos7 ~]# pip2 install "docker-compose<1.29"
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.    
Collecting docker-compose<1.29
  Downloading docker_compose-1.26.2-py2.py3-none-any.whl (139 kB)
     |████████████████████████████████| 139 kB 9.5 MB/s
Collecting subprocess32<4,>=3.5.4; python_version < "3.2"
  Downloading subprocess32-3.5.4-cp27-cp27mu-manylinux2014_x86_64.whl (69 kB)
     |████████████████████████████████| 69 kB 15.9 MB/s
Collecting texttable<2,>=0.9.0
  Downloading texttable-1.6.3-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: requests<3,>=2.20.0 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (2.25.1)
Requirement already satisfied: websocket-client<1,>=0.32.0 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (0.59.0)
Collecting jsonschema<4,>=2.5.1
  Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 9.6 MB/s
Requirement already satisfied: docker[ssh]<5,>=4.2.2 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (4.4.4)
Collecting distro<2,>=1.5.0
  Downloading distro-1.5.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: ipaddress<2,>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (1.0.16)
Requirement already satisfied: backports.ssl-match-hostname<4,>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (3.5.0.1)
Collecting docopt<1,>=0.6.1
  Downloading docopt-0.6.2.tar.gz (25 kB)
Collecting dockerpty<1,>=0.4.1
  Downloading dockerpty-0.4.1.tar.gz (13 kB)
Collecting cached-property<2,>=1.2.0
  Downloading cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)
Collecting PyYAML<6,>=3.10
  Downloading PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl (574 kB)
     |████████████████████████████████| 574 kB 30.7 MB/s
Collecting python-dotenv<1,>=0.13.0
  Downloading python_dotenv-0.18.0-py2.py3-none-any.whl (18 kB)
Collecting enum34<2,>=1.0.4; python_version < "3.4"
  Downloading enum34-1.1.10-py2-none-any.whl (11 kB)
Requirement already satisfied: six<2,>=1.3.0 in /usr/lib/python2.7/site-packages (from docker-compose<1.29) (1.16.0)
Collecting backports.shutil-get-terminal-size==1.0.0; python_version < "3.3"
  Downloading backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl (6.5 kB)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (1.26.5)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests<3,>=2.20.0->docker-compose<1.29) (2021.5.30)
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from jsonschema<4,>=2.5.1->docker-compose<1.29) (0.9.8)
Collecting functools32; python_version < "3"
  Downloading functools32-3.2.3-2.tar.gz (31 kB)
Collecting pyrsistent>=0.14.0
  Downloading pyrsistent-0.16.1.tar.gz (108 kB)
     |████████████████████████████████| 108 kB 60.6 MB/s
Collecting attrs>=17.4.0
  Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 5.3 MB/s
Collecting importlib-metadata; python_version < "3.8"
  Downloading importlib_metadata-2.1.1-py2.py3-none-any.whl (10 kB)
Collecting paramiko>=2.4.2; extra == "ssh"
  Downloading paramiko-2.7.2-py2.py3-none-any.whl (206 kB)
     |████████████████████████████████| 206 kB 42.3 MB/s
Collecting typing; python_version < "3.5"
  Downloading typing-3.10.0.0-py2-none-any.whl (26 kB)
Collecting contextlib2; python_version < "3"
  Downloading contextlib2-0.6.0.post1-py2.py3-none-any.whl (9.8 kB)
Collecting pathlib2; python_version < "3"
  Downloading pathlib2-2.3.5-py2.py3-none-any.whl (18 kB)
Collecting zipp>=0.5
  Downloading zipp-1.2.0-py2.py3-none-any.whl (4.8 kB)
Collecting configparser>=3.5; python_version < "3"
  Downloading configparser-4.0.2-py2.py3-none-any.whl (22 kB)
Collecting cryptography>=2.5
  Downloading cryptography-3.3.2-cp27-cp27mu-manylinux2010_x86_64.whl (2.6 MB)
     |████████████████████████████████| 2.6 MB 60.2 MB/s
Collecting pynacl>=1.0.1
  Downloading PyNaCl-1.4.0-cp27-cp27mu-manylinux1_x86_64.whl (964 kB)
     |████████████████████████████████| 964 kB 30.9 MB/s
Collecting bcrypt>=3.1.3
  Downloading bcrypt-3.1.7-cp27-cp27mu-manylinux1_x86_64.whl (59 kB)
     |████████████████████████████████| 59 kB 14.4 MB/s
Collecting scandir; python_version < "3.5"
  Downloading scandir-1.10.0.tar.gz (33 kB)
Collecting cffi>=1.12
  Downloading cffi-1.14.5-cp27-cp27mu-manylinux1_x86_64.whl (389 kB)
     |████████████████████████████████| 389 kB 45.2 MB/s
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 37.1 MB/s
Using legacy 'setup.py install' for docopt, since package 'wheel' is not installed.
Using legacy 'setup.py install' for dockerpty, since package 'wheel' is not installed.
Using legacy 'setup.py install' for functools32, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyrsistent, since package 'wheel' is not installed.
Using legacy 'setup.py install' for scandir, since package 'wheel' is not installed.
Installing collected packages: subprocess32, texttable, functools32, pyrsistent, attrs, contextlib2, scandir, pathlib2, zipp, configparser, importlib-metadata, jsonschema, distro, docopt, dockerpty, cached-property, PyYAML, typing, python-dotenv, enum34, backports.shutil-get-terminal-size, docker-compose, pycparser, cffi, cryptography, pynacl, bcrypt, paramiko
    Running setup.py install for functools32 ... done
    Running setup.py install for pyrsistent ... done
    Running setup.py install for scandir ... done
    Running setup.py install for docopt ... done
    Running setup.py install for dockerpty ... done
Successfully installed PyYAML-5.4.1 attrs-21.2.0 backports.shutil-get-terminal-size-1.0.0 bcrypt-3.1.7 cached-property-1.5.2 cffi-1.14.5 configparser-4.0.2 contextlib2-0.6.0.post1 cryptography-3.3.2 distro-1.5.0 docker-compose-1.26.2 dockerpty-0.4.1 docopt-0.6.2 enum34-1.1.10 functools32-3.2.3.post2 importlib-metadata-2.1.1 jsonschema-3.2.0 paramiko-2.7.2 pathlib2-2.3.5 pycparser-2.20 pynacl-1.4.0 pyrsistent-0.16.1 python-dotenv-0.18.0 scandir-1.10.0 subprocess32-3.5.4 texttable-1.6.3 typing-3.10.0.0 zipp-1.2.0

So my conclusion is that there is not any bug within the roles itself. It is more that the prerequisites for python based docker-compose and docker packages which is tricky.

jamiejackson commented 3 years ago

Thanks for the conversation, @haxorof . I'm fine with wontfix for now, since we've got a workaround documented, above. If others end up hitting the same issue, we can reconsider.