From a6d9345105f4dba1a609ed88c6c06a723c2fcb71 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 7 Jan 2022 12:44:30 +0100 Subject: [PATCH] Install docker-compose using pip Change-Id: I9fe62b1d0501c8fd25c5bd210a423a5d8c41922f --- playbooks/docker/pre.yaml | 1 + roles/tobiko-ensure-docker-compose/defaults/main.yaml | 2 ++ roles/tobiko-ensure-docker-compose/tasks/main.yaml | 11 ++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/playbooks/docker/pre.yaml b/playbooks/docker/pre.yaml index 91617fb05..00fc90799 100644 --- a/playbooks/docker/pre.yaml +++ b/playbooks/docker/pre.yaml @@ -3,6 +3,7 @@ - hosts: all roles: - role: ensure-docker + - role: tobiko-ensure-python3 - role: tobiko-ensure-docker-compose - role: tobiko-docker-compose vars: diff --git a/roles/tobiko-ensure-docker-compose/defaults/main.yaml b/roles/tobiko-ensure-docker-compose/defaults/main.yaml index 5b9851fa5..bb0e50bbb 100644 --- a/roles/tobiko-ensure-docker-compose/defaults/main.yaml +++ b/roles/tobiko-ensure-docker-compose/defaults/main.yaml @@ -1,3 +1,5 @@ --- docker_compose_executable: /usr/local/bin/docker-compose +docker_compose_install_using_pip: true +docker_compose_install_using_curl: not docker_compose_install_using_pip diff --git a/roles/tobiko-ensure-docker-compose/tasks/main.yaml b/roles/tobiko-ensure-docker-compose/tasks/main.yaml index e8da6015c..d76746a39 100644 --- a/roles/tobiko-ensure-docker-compose/tasks/main.yaml +++ b/roles/tobiko-ensure-docker-compose/tasks/main.yaml @@ -1,6 +1,14 @@ --- -- name: "Install latest Docker compose" +- name: "Install latest Docker compose with Pip" + become: true + shell: | + set -x + python3 -m pip install docker-compose + when: docker_compose_install_using_pip + + +- name: "Install latest Docker compose with Curl" become: true shell: | set -x @@ -15,3 +23,4 @@ mkdir -p $(dirname '{{ docker_compose_executable }}') curl -L ${URL} > '{{ docker_compose_executable }}' chmod +x '{{ docker_compose_executable }}' + when: docker_compose_install_using_curl