From 7f23e66db2119fc8844e9767f9fd2c667fa9492b Mon Sep 17 00:00:00 2001 From: "D. Ror." Date: Fri, 8 Nov 2024 14:29:32 -0500 Subject: [PATCH] [ansible] Set up for more general architecture support (#3438) --- deploy/ansible/playbook_k3s_airgapped_files.yml | 10 +++++----- .../roles/container_engine/defaults/main.yml | 1 + .../ansible/roles/container_engine/tasks/main.yml | 2 +- .../roles/container_images/defaults/main.yml | 1 + .../ansible/roles/container_images/tasks/main.yml | 13 +++++++++---- deploy/ansible/roles/helm_install/defaults/main.yml | 4 ++-- deploy/ansible/roles/helm_install/tasks/main.yml | 7 +++---- deploy/ansible/vars/k3s_versions.yml | 1 + 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/deploy/ansible/playbook_k3s_airgapped_files.yml b/deploy/ansible/playbook_k3s_airgapped_files.yml index 7911849fef..99522e8d4e 100644 --- a/deploy/ansible/playbook_k3s_airgapped_files.yml +++ b/deploy/ansible/playbook_k3s_airgapped_files.yml @@ -32,13 +32,13 @@ dest: "{{ package_dir }}/{{ item }}" url: "https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/{{ item }}" loop: - - k3s-airgap-images-amd64.tar.zst + - k3s-airgap-images-{{ cpu_arch }}.tar.zst - k3s - - sha256sum-amd64.txt + - sha256sum-{{ cpu_arch }}.txt - name: Verify k3s downloads shell: - cmd: sha256sum --check --ignore-missing sha256sum-amd64.txt + cmd: sha256sum --check --ignore-missing sha256sum-{{ cpu_arch }}.txt chdir: "{{ package_dir }}" changed_when: false @@ -50,9 +50,9 @@ - name: Download kubectl get_url: dest: "{{ package_dir }}/kubectl" - url: "https://dl.k8s.io/release/{{ kubectl_version }}/bin/linux/amd64/kubectl" + url: "https://dl.k8s.io/release/{{ kubectl_version }}/bin/linux/{{ cpu_arch }}/kubectl" - name: Download helm get_url: dest: "{{ package_dir }}/helm.tar.gz" - url: "https://get.helm.sh/helm-{{ helm_version }}-linux-amd64.tar.gz" + url: "https://get.helm.sh/helm-{{ helm_version }}-linux-{{ cpu_arch }}.tar.gz" diff --git a/deploy/ansible/roles/container_engine/defaults/main.yml b/deploy/ansible/roles/container_engine/defaults/main.yml index 1276e993b3..12c2d6e30e 100644 --- a/deploy/ansible/roles/container_engine/defaults/main.yml +++ b/deploy/ansible/roles/container_engine/defaults/main.yml @@ -3,3 +3,4 @@ container_packages: - containerd.io keyring_location: /etc/apt/keyrings +cpu_arch: amd64 diff --git a/deploy/ansible/roles/container_engine/tasks/main.yml b/deploy/ansible/roles/container_engine/tasks/main.yml index 8508c4bc46..c884eb68e1 100644 --- a/deploy/ansible/roles/container_engine/tasks/main.yml +++ b/deploy/ansible/roles/container_engine/tasks/main.yml @@ -40,7 +40,7 @@ - name: Add Docker repository apt_repository: - repo: "deb [arch=amd64 signed-by={{ keyring_location }}/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" + repo: "deb [arch={{ cpu_arch }} signed-by={{ keyring_location }}/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" state: present filename: docker diff --git a/deploy/ansible/roles/container_images/defaults/main.yml b/deploy/ansible/roles/container_images/defaults/main.yml index 02994e8520..aae28e44e4 100644 --- a/deploy/ansible/roles/container_images/defaults/main.yml +++ b/deploy/ansible/roles/container_images/defaults/main.yml @@ -4,3 +4,4 @@ source_image_dir: ../airgap-images airgap_image_dir: /var/lib/rancher/k3s/agent/images +cpu_arch: amd64 diff --git a/deploy/ansible/roles/container_images/tasks/main.yml b/deploy/ansible/roles/container_images/tasks/main.yml index d5edea306d..e4a68fd04c 100644 --- a/deploy/ansible/roles/container_images/tasks/main.yml +++ b/deploy/ansible/roles/container_images/tasks/main.yml @@ -1,6 +1,11 @@ --- +############################################################## +# Role: container_images +# # Setup airgap images in {{ airgap_image_dir }} to be # available when k3s and subsequent helm charts are installed. +# +############################################################## - name: Create airgap image directory file: @@ -18,9 +23,9 @@ group: root mode: 0644 loop: - - k3s-airgap-images-amd64.tar.zst - - middleware-airgap-images-amd64.tar.zst - - combine-airgap-images-amd64.tar.zst + - k3s-airgap-images-{{ cpu_arch }}.tar.zst + - middleware-airgap-images-{{ cpu_arch }}.tar.zst + - combine-airgap-images-{{ cpu_arch }}.tar.zst # Add k3s, kubectl and the k3s installation script to # /usr/local/bin @@ -51,7 +56,7 @@ - name: Create link to helm binary file: - src: /opt/helm/{{ helm_version }}/linux-amd64/helm + src: /opt/helm/{{ helm_version }}/linux-{{ cpu_arch }}/helm dest: /usr/local/bin/helm state: link owner: root diff --git a/deploy/ansible/roles/helm_install/defaults/main.yml b/deploy/ansible/roles/helm_install/defaults/main.yml index 54401b3cdc..785842645d 100644 --- a/deploy/ansible/roles/helm_install/defaults/main.yml +++ b/deploy/ansible/roles/helm_install/defaults/main.yml @@ -1,5 +1,5 @@ --- helm_version: v3.15.2 -helm_arch: linux-amd64 +cpu_arch: amd64 -helm_download_dir: /opt/helm-{{ helm_version }}-{{ helm_arch }} +helm_download_dir: /opt/helm-{{ helm_version }}-linux-{{ cpu_arch }} diff --git a/deploy/ansible/roles/helm_install/tasks/main.yml b/deploy/ansible/roles/helm_install/tasks/main.yml index 6956f09f06..76e51b4ea4 100644 --- a/deploy/ansible/roles/helm_install/tasks/main.yml +++ b/deploy/ansible/roles/helm_install/tasks/main.yml @@ -9,8 +9,7 @@ - name: Get Latest Release get_url: - # https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz - url: "https://get.helm.sh/helm-{{ helm_version }}-{{ helm_arch }}.tar.gz" + url: "https://get.helm.sh/helm-{{ helm_version }}-linux-{{ cpu_arch }}.tar.gz" dest: "{{ helm_download_dir }}/helm.tar.gz" owner: root group: root @@ -20,11 +19,11 @@ command: cmd: "tar -zxvf {{ helm_download_dir }}/helm.tar.gz" chdir: "{{ helm_download_dir }}" - creates: "{{ helm_download_dir }}/{{ helm_arch }}/helm" + creates: "{{ helm_download_dir }}/linux-{{ cpu_arch }}/helm" - name: Link to extracted helm file file: - src: "{{ helm_download_dir }}/{{ helm_arch }}/helm" + src: "{{ helm_download_dir }}/linux-{{ cpu_arch }}/helm" path: /usr/local/bin/helm state: link owner: root diff --git a/deploy/ansible/vars/k3s_versions.yml b/deploy/ansible/vars/k3s_versions.yml index e3a79b990f..8081a4acb5 100644 --- a/deploy/ansible/vars/k3s_versions.yml +++ b/deploy/ansible/vars/k3s_versions.yml @@ -2,3 +2,4 @@ k3s_version: "v1.30.1%2Bk3s1" kubectl_version: "v1.30.2" helm_version: "v3.15.2" +cpu_arch: "amd64"