From 32129135d78d9f957815ba07d5add28cc64c5a06 Mon Sep 17 00:00:00 2001 From: Julian Euler Date: Wed, 26 Jan 2022 17:25:04 +0100 Subject: [PATCH 1/3] automatic architecture detection --- defaults/main.yml | 3 +-- tasks/setup-Debian.yml | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1b9de37..d75b81f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,8 +20,7 @@ docker_repo_url: https://download.docker.com/linux # Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable -docker_apt_arch: amd64 -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_repository: "deb [arch={{ docker_apt_arch.stdout }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index cc444ca..bce94fe 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -44,6 +44,13 @@ warn: false when: add_repository_key is failed +- name: Get DEB architecture + shell: dpkg --print-architecture + register: docker_apt_arch + check_mode: false + changed_when: false + failed_when: false + - name: Add Docker repository. apt_repository: repo: "{{ docker_apt_repository }}" From bfba781af049b6ba422c420008ee11d69ad9c29b Mon Sep 17 00:00:00 2001 From: Julian Euler Date: Wed, 26 Jan 2022 17:25:55 +0100 Subject: [PATCH 2/3] more robust compose version comparison --- tasks/docker-compose.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tasks/docker-compose.yml b/tasks/docker-compose.yml index 335554d..9a49668 100644 --- a/tasks/docker-compose.yml +++ b/tasks/docker-compose.yml @@ -1,11 +1,15 @@ --- - name: Check current docker-compose version. command: "{{ docker_compose_path }} --version" - register: docker_compose_current_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 }}" @@ -20,5 +24,6 @@ dest: "{{ docker_compose_path }}" mode: 0755 when: > - docker_compose_current_version.stdout is not defined - or docker_compose_version not in docker_compose_current_version.stdout + (docker_compose_current_version is not defined) + or (docker_compose_current_version|length == 0) + or (docker_compose_current_version is version(docker_compose_version, '<')) From c9e77fb0cf9f9e1c4f181bfdec03d33c255d1641 Mon Sep 17 00:00:00 2001 From: Julian Euler Date: Wed, 26 Jan 2022 17:34:10 +0100 Subject: [PATCH 3/3] Revert "automatic architecture detection" This reverts commit 32129135d78d9f957815ba07d5add28cc64c5a06. --- defaults/main.yml | 3 ++- tasks/setup-Debian.yml | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d75b81f..1b9de37 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,7 +20,8 @@ docker_repo_url: https://download.docker.com/linux # Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable -docker_apt_repository: "deb [arch={{ docker_apt_arch.stdout }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_arch: amd64 +docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index bce94fe..cc444ca 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -44,13 +44,6 @@ warn: false when: add_repository_key is failed -- name: Get DEB architecture - shell: dpkg --print-architecture - register: docker_apt_arch - check_mode: false - changed_when: false - failed_when: false - - name: Add Docker repository. apt_repository: repo: "{{ docker_apt_repository }}"