From cef4b7892e1d12a3f5653c6f2bac27946382f39d Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 4 Apr 2022 10:32:17 -0500 Subject: [PATCH] Attempt to fix some Docker compose version comparison bugs. --- tasks/docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/docker-compose.yml b/tasks/docker-compose.yml index 9a49668..4ccd44a 100644 --- a/tasks/docker-compose.yml +++ b/tasks/docker-compose.yml @@ -8,15 +8,15 @@ - set_fact: docker_compose_current_version: "{{ docker_compose_vsn.stdout | regex_search('(\\d+(\\.\\d+)+)') }}" - when: - - docker_compose_vsn.stdout is defined + when: docker_compose_vsn.stdout is defined + - name: Delete existing docker-compose version if it's different. file: path: "{{ docker_compose_path }}" state: absent when: > docker_compose_current_version.stdout is defined - and docker_compose_version not in docker_compose_current_version.stdout + and (docker_compose_version | regex_replace('v', '')) not in docker_compose_current_version.stdout - name: Install Docker Compose (if configured). get_url: @@ -26,4 +26,4 @@ when: > (docker_compose_current_version is not defined) or (docker_compose_current_version|length == 0) - or (docker_compose_current_version is version(docker_compose_version, '<')) + or (docker_compose_current_version is version((docker_compose_version | regex_replace('v', '')), '<'))