mirror of
https://github.com/Maks1mS/ansible-role-docker.git
synced 2024-12-24 16:44:41 +03:00
c5f2b14d9a
Signed-off-by: Norman Ziegner <norman.ziegner@ufz.de>
30 lines
1009 B
YAML
30 lines
1009 B
YAML
---
|
|
- name: Check current docker-compose version.
|
|
command: "{{ docker_compose_path }} --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 }}"
|
|
state: absent
|
|
when: >
|
|
docker_compose_current_version is defined
|
|
and (docker_compose_version | regex_replace('v', '')) not in docker_compose_current_version
|
|
|
|
- name: Install Docker Compose (if configured).
|
|
get_url:
|
|
url: "{{ docker_compose_url }}"
|
|
dest: "{{ docker_compose_path }}"
|
|
mode: 0755
|
|
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 | regex_replace('v', '')), '<'))
|