Fix version regex to pick 'v*' tags
Change-Id: I783d25439ff3b47781d206f7d72fba7575add140
This commit is contained in:
parent
3b56760264
commit
6b76177616
@ -1,5 +1,3 @@
|
||||
---
|
||||
|
||||
docker_compose_executable: /usr/local/bin/docker-compose
|
||||
docker_compose_install_using_pip: true
|
||||
docker_compose_install_using_curl: not docker_compose_install_using_pip
|
||||
|
@ -1,26 +1,40 @@
|
||||
---
|
||||
|
||||
- name: "Install latest Docker compose with Pip"
|
||||
become: true
|
||||
shell: |
|
||||
set -x
|
||||
python3 -m pip install docker-compose
|
||||
when: docker_compose_install_using_pip
|
||||
- block:
|
||||
- name: install latest Docker compose using pip
|
||||
become: true
|
||||
shell: |
|
||||
set -x
|
||||
python3 -m pip install docker-compose
|
||||
|
||||
- name: get docker compose location path
|
||||
shell: which docker-compose
|
||||
register: get_docker_compose_path
|
||||
|
||||
- name: "Install latest Docker compose with Curl"
|
||||
become: true
|
||||
shell: |
|
||||
set -x
|
||||
VERSION=$(
|
||||
git ls-remote https://github.com/docker/compose |
|
||||
grep refs/tags |
|
||||
grep -oE "[0-9]+\.[0-9][0-9]+\.[0-9]+$" |
|
||||
sort --version-sort |
|
||||
tail -n 1)
|
||||
ARCH=$(uname -s)-$(uname -m)
|
||||
URL=https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-${ARCH}
|
||||
mkdir -p $(dirname '{{ docker_compose_executable }}')
|
||||
curl -L ${URL} > '{{ docker_compose_executable }}'
|
||||
chmod +x '{{ docker_compose_executable }}'
|
||||
when: docker_compose_install_using_curl
|
||||
- name: save docker compose path fact
|
||||
set_fact:
|
||||
docker_compose_executable: '{{ get_docker_compose_path.stdout.strip() }}'
|
||||
|
||||
- debug: var=docker_compose_executable
|
||||
|
||||
rescue:
|
||||
- name: install latest Docker compose with Curl
|
||||
become: true
|
||||
shell: |
|
||||
set -x
|
||||
VERSION=$(
|
||||
git ls-remote https://github.com/docker/compose |
|
||||
awk '/refs\/tags\/v/{print $2}' |
|
||||
sort --version-sort |
|
||||
tail -n 1)
|
||||
ARCH=$(uname -s)-$(uname -m)
|
||||
URL=https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-${ARCH}
|
||||
mkdir -p $(dirname '{{ docker_compose_executable }}')
|
||||
curl -L ${URL} > '{{ docker_compose_executable }}'
|
||||
chmod +x '{{ docker_compose_executable }}'
|
||||
|
||||
- name: save docker compose path fact
|
||||
set_fact:
|
||||
docker_compose_executable: '{{ docker_compose_executable }}'
|
||||
|
||||
- debug: var=docker_compose_executable
|
||||
|
Loading…
Reference in New Issue
Block a user