mirror of
https://github.com/Maks1mS/ansible-role-docker.git
synced 2024-12-24 08:34:40 +03:00
more robust compose version comparison
This commit is contained in:
parent
32129135d7
commit
bfba781af0
@ -1,11 +1,15 @@
|
|||||||
---
|
---
|
||||||
- name: Check current docker-compose version.
|
- name: Check current docker-compose version.
|
||||||
command: "{{ docker_compose_path }} --version"
|
command: "{{ docker_compose_path }} --version"
|
||||||
register: docker_compose_current_version
|
register: docker_compose_vsn
|
||||||
check_mode: false
|
check_mode: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_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.
|
- name: Delete existing docker-compose version if it's different.
|
||||||
file:
|
file:
|
||||||
path: "{{ docker_compose_path }}"
|
path: "{{ docker_compose_path }}"
|
||||||
@ -20,5 +24,6 @@
|
|||||||
dest: "{{ docker_compose_path }}"
|
dest: "{{ docker_compose_path }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
when: >
|
when: >
|
||||||
docker_compose_current_version.stdout is not defined
|
(docker_compose_current_version is not defined)
|
||||||
or docker_compose_version not in docker_compose_current_version.stdout
|
or (docker_compose_current_version|length == 0)
|
||||||
|
or (docker_compose_current_version is version(docker_compose_version, '<'))
|
||||||
|
Loading…
Reference in New Issue
Block a user