From 900945dec110c5e6d731f2fbe9acba84c8f3799c Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Mon, 1 Feb 2021 02:11:23 +0100 Subject: [PATCH] docker: use ansible conditional for arch selection in-line substitution is more tricky. this is a simple way to explicitly declare the Docker apt repo string by architecture. --- roles/gitlab-runner/tasks/docker.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/gitlab-runner/tasks/docker.yml b/roles/gitlab-runner/tasks/docker.yml index cde36a2..1613de3 100644 --- a/roles/gitlab-runner/tasks/docker.yml +++ b/roles/gitlab-runner/tasks/docker.yml @@ -8,11 +8,19 @@ id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 url: https://download.docker.com/linux/debian/gpg -- name: Add Docker apt repo to souces.list +- name: Add arm64 Docker apt repo to souces.list apt_repository: codename: "{{ ansible_distribution_release }}" - repo: "deb [arch={% if {{ ansible_architecture }} == aarch64 %}arm64 {% endif %}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" + repo: "deb [arch=arm64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" update_cache: yes + when: ansible_architecture == "aarch64" + +- name: Add amd64 Docker apt repo to souces.list + apt_repository: + codename: "{{ ansible_distribution_release }}" + repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" + update_cache: yes + when: ansible_architecture == "amd64" - name: Install Docker CE apt: