2017-05-03 17:51:04 +02:00
|
|
|
---
|
|
|
|
- name: Check current docker-compose version.
|
|
|
|
command: docker-compose --version
|
|
|
|
register: docker_compose_current_version
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
2020-06-18 20:15:33 +02:00
|
|
|
- name: Get latest version from docker-compose (if configured)
|
|
|
|
block:
|
|
|
|
- name: Get latest version of docker-compose from Github API
|
|
|
|
uri:
|
|
|
|
url: https://api.github.com/repos/docker/compose/releases/latest
|
|
|
|
return_content: yes
|
|
|
|
register: url_content
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
- name: Set latest version in docker_compose_version variable
|
|
|
|
set_fact:
|
|
|
|
docker_compose_version: "{{url_content.json.name }}"
|
|
|
|
when: docker_compose_version == 'latest'
|
|
|
|
|
2017-05-03 17:51:04 +02:00
|
|
|
- name: Delete existing docker-compose version if it's different.
|
|
|
|
file:
|
2017-05-03 18:06:24 +02:00
|
|
|
path: "{{ docker_compose_path }}"
|
2017-05-03 17:51:04 +02:00
|
|
|
state: absent
|
2017-05-03 17:59:50 +02:00
|
|
|
when: >
|
|
|
|
docker_compose_current_version.stdout is defined
|
|
|
|
and docker_compose_version not in docker_compose_current_version.stdout
|
2017-05-03 17:51:04 +02:00
|
|
|
|
|
|
|
- name: Install Docker Compose (if configured).
|
|
|
|
get_url:
|
|
|
|
url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
|
2017-05-03 18:06:24 +02:00
|
|
|
dest: "{{ docker_compose_path }}"
|
2017-05-03 17:51:04 +02:00
|
|
|
mode: 0755
|