From 25727fab47a18dd146e63675097f376385cf3eac Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 28 May 2024 10:39:04 -0500 Subject: [PATCH] Add golang based docker compose tool. This installs the golang based compose (v2) tool. Also make it the python based tool optional, but installed by default. The docker compose v2 tool comes from either: - Disrto : Moby Engine : docker-compose-v2 : Focal -> Oracular - Upstream : Docker Inc : docker-compose-plugin : Trusty -> Noble With manual checking I can't see any distro older than focal that makes use of the install-docker role, and all in-tree users pull from upstream, so I think adding the golang compose tool without checking the release is safe. Change-Id: Ib8b5af40e626cd2d1a12b643f348001b9fdf4586 --- .../roles/install-docker/defaults/main.yaml | 1 + .../roles/install-docker/tasks/distro.yaml | 4 +- .../roles/install-docker/tasks/main.yaml | 41 ++++++++++--------- .../roles/install-docker/tasks/upstream.yaml | 4 +- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/playbooks/roles/install-docker/defaults/main.yaml b/playbooks/roles/install-docker/defaults/main.yaml index 98dbb13cd1..0f92e84217 100644 --- a/playbooks/roles/install-docker/defaults/main.yaml +++ b/playbooks/roles/install-docker/defaults/main.yaml @@ -1,2 +1,3 @@ use_upstream_docker: True docker_update_channel: stable +with_python_compose: True diff --git a/playbooks/roles/install-docker/tasks/distro.yaml b/playbooks/roles/install-docker/tasks/distro.yaml index 99fd589ac7..412b7d4a34 100644 --- a/playbooks/roles/install-docker/tasks/distro.yaml +++ b/playbooks/roles/install-docker/tasks/distro.yaml @@ -1,5 +1,7 @@ - name: Install docker become: yes package: - name: docker.io + name: + - docker.io + - docker-compose-v2 state: present diff --git a/playbooks/roles/install-docker/tasks/main.yaml b/playbooks/roles/install-docker/tasks/main.yaml index de13ac878f..e340f703a9 100644 --- a/playbooks/roles/install-docker/tasks/main.yaml +++ b/playbooks/roles/install-docker/tasks/main.yaml @@ -34,26 +34,29 @@ - libssl-dev state: present -- name: ensure pip3 is installed - include_role: - name: pip3 +- name: Install python docker-compose if needed + when: with_python_compose|bool + block: + - name: ensure pip3 is installed + include_role: + name: pip3 -- name: Install docker-compose - pip: - name: - # The explicit pin of requests is a temporary workaround to getting - # docker-compose functioning again after requests and urllib3 updates. - # Unfortunately python docker-compose is abandonware and we will need - # to migrate to the new docker plugin system or distro packages, but - # until then this is a quick workaround that will get things moving - # again. - # The explicit pin of docker is required as py docker 7.0 introduced - # incompatibilities with python docker-compose. - - requests<2.30.0 - - docker<7.0.0 - - docker-compose - state: present - executable: pip3 + - name: Install docker-compose + pip: + name: + # The explicit pin of requests is a temporary workaround to getting + # docker-compose functioning again after requests and urllib3 updates. + # Unfortunately python docker-compose is abandonware and we will need + # to migrate to the new docker plugin system or distro packages, but + # until then this is a quick workaround that will get things moving + # again. + # The explicit pin of docker is required as py docker 7.0 introduced + # incompatibilities with python docker-compose. + - requests<2.30.0 + - docker<7.0.0 + - docker-compose + state: present + executable: pip3 - name: Install rsyslog redirector for container tags copy: diff --git a/playbooks/roles/install-docker/tasks/upstream.yaml b/playbooks/roles/install-docker/tasks/upstream.yaml index 743f06283d..fc54657a68 100644 --- a/playbooks/roles/install-docker/tasks/upstream.yaml +++ b/playbooks/roles/install-docker/tasks/upstream.yaml @@ -49,6 +49,8 @@ - name: Install docker become: yes apt: - name: docker-ce + name: + - docker-ce + - docker-compose-plugin state: present update_cache: yes