Add ability to look up the latest docker-compose version on Github API

This commit is contained in:
Robin Reinhardt 2020-06-18 20:15:33 +02:00
parent fa52c5f28b
commit 33c5c2e6d0

View File

@ -5,6 +5,20 @@
changed_when: false changed_when: false
failed_when: false failed_when: false
- 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'
- 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 }}"