This commit is contained in:
robinreinhardt 2022-01-17 09:08:09 -05:00 committed by GitHub
commit 0893d4bbe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -32,7 +32,7 @@ Variables to control the state of the `docker` service, and whether it should st
docker_compose_arch: x86_64
docker_compose_path: /usr/local/bin/docker-compose
Docker Compose installation options.
Docker Compose installation options. You can use `docker_compose_version: "latest"` to get the current latest version.
docker_repo_url: https://download.docker.com/linux

View File

@ -6,6 +6,20 @@
changed_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.
file:
path: "{{ docker_compose_path }}"