Merge pull request #331 from Lithimlin/compose-version

Compose version
This commit is contained in:
Jeff Geerling 2022-04-04 09:39:37 -05:00 committed by GitHub
commit 496a188cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,15 @@
---
- name: Check current docker-compose version.
command: "{{ docker_compose_path }} --version"
register: docker_compose_current_version
register: docker_compose_vsn
check_mode: false
changed_when: false
failed_when: false
- set_fact:
docker_compose_current_version: "{{ docker_compose_vsn.stdout | regex_search('(\\d+(\\.\\d+)+)') }}"
when:
- docker_compose_vsn.stdout is defined
- name: Delete existing docker-compose version if it's different.
file:
path: "{{ docker_compose_path }}"
@ -20,5 +24,6 @@
dest: "{{ docker_compose_path }}"
mode: 0755
when: >
docker_compose_current_version.stdout is not defined
or docker_compose_version not in docker_compose_current_version.stdout
(docker_compose_current_version is not defined)
or (docker_compose_current_version|length == 0)
or (docker_compose_current_version is version(docker_compose_version, '<'))