From 247b9e83d8d30c8d0cd68b4095e1ad577645c36a Mon Sep 17 00:00:00 2001
From: Antoine Legrand <2t.antoine@gmail.com>
Date: Mon, 20 Aug 2018 16:07:27 +0200
Subject: [PATCH] etcd arch-image

---
 roles/download/defaults/main.yml                   |  4 ++--
 roles/download/tasks/main.yml                      |  4 ----
 .../kubernetes/preinstall/tasks/0040-set_facts.yml | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml
index d673c72b5..2a1d71193 100644
--- a/roles/download/defaults/main.yml
+++ b/roles/download/defaults/main.yml
@@ -27,7 +27,7 @@ download_always_pull: False
 download_delegate: "{% if download_localhost %}localhost{% else %}{{groups['kube-master'][0]}}{% endif %}"
 
 # Arch of Docker images and needed packages
-image_arch: amd64
+image_arch: "{{host_architecture | default('amd64')}}"
 
 # Versions
 kube_version: v1.11.2
@@ -62,7 +62,7 @@ vault_binary_checksum: 3c4d70ba71619a43229e65c67830e30e050eab7a81ac6b28325ff707e
 
 # Containers
 etcd_image_repo: "quay.io/coreos/etcd"
-etcd_image_tag: "{{ etcd_version }}"
+etcd_image_tag: "{{ etcd_version }}{%- if image_arch != 'amd64' -%}-{{ image_arch }}{%- endif -%}"
 flannel_image_repo: "quay.io/coreos/flannel"
 flannel_image_tag: "{{ flannel_version }}"
 flannel_cni_image_repo: "quay.io/coreos/flannel-cni"
diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml
index 1984f626d..397689968 100644
--- a/roles/download/tasks/main.yml
+++ b/roles/download/tasks/main.yml
@@ -1,8 +1,4 @@
 ---
-- include_tasks: download_prep.yml
-  when:
-    - not skip_downloads|default(false)
-
 - name: "Download items"
   include_tasks: "download_{% if download.container %}container{% else %}file{% endif %}.yml"
   vars:
diff --git a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml
index d2bb46937..1fddb7de5 100644
--- a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml
+++ b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml
@@ -1,4 +1,18 @@
 ---
+- set_fact:
+    architecture_groups:
+      x86_64: amd64
+      aarch64: arm64
+
+- name: ansible_architecture_rename
+  set_fact:
+    host_architecture: >-
+      {%- if ansible_architecture in architecture_groups -%}
+      {{architecture_groups[ansible_architecture]}}
+      {%- else -%}
+       {{ansible_architecture}}
+      {% endif %}
+
 - name: Force binaries directory for Container Linux by CoreOS
   set_fact:
     bin_dir: "/opt/bin"
-- 
GitLab