From 07b73d8b1e360cfb6180a9ac7f1dac762ea22da1 Mon Sep 17 00:00:00 2001 From: Randall Mason Date: Sat, 2 Mar 2024 07:47:49 -0600 Subject: [PATCH] Allow other architecture hosts This add support for arm64 (which shows up in ansible as aarch64). To add another, add something like this to k3s_architectures: ``` : arch_suffix: "" arch_sum: "" ``` Tested with a raspberry pi running debian aarch64 upstream. --- metal/roles/k3s/defaults/main.yml | 9 +++++++++ metal/roles/k3s/tasks/main.yml | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/metal/roles/k3s/defaults/main.yml b/metal/roles/k3s/defaults/main.yml index 37ca151b2e..6b3aabb21d 100644 --- a/metal/roles/k3s/defaults/main.yml +++ b/metal/roles/k3s/defaults/main.yml @@ -1,4 +1,13 @@ k3s_version: v1.28.3+k3s2 + +k3s_architectures: + x86_64: + arch_suffix: "" + arch_sum: sha256sum-amd64.txt + aarch64: + arch_suffix: "-arm64" + arch_sum: sha256sum-arm64.txt + k3s_config_file: /etc/rancher/k3s/config.yaml k3s_token_file: /etc/rancher/node/password k3s_service_file: /etc/systemd/system/k3s.service diff --git a/metal/roles/k3s/tasks/main.yml b/metal/roles/k3s/tasks/main.yml index 21cd85c06c..1e9ee799d0 100644 --- a/metal/roles/k3s/tasks/main.yml +++ b/metal/roles/k3s/tasks/main.yml @@ -1,16 +1,17 @@ - name: Download k3s binary ansible.builtin.get_url: - url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s - checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/sha256sum-amd64.txt - dest: "{{ role_path }}/files/bin/k3s" + url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s{{ k3s_architectures[item].arch_suffix }} + checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/{{ k3s_architectures[item].arch_sum }} + dest: "{{ role_path }}/files/bin/k3s{{ k3s_architectures[item].arch_suffix }}" mode: 0755 delegate_to: localhost run_once: true register: k3s_binary + loop: "{{ k3s_architectures.keys() | list }}" - name: Copy k3s binary to nodes ansible.builtin.copy: - src: bin/k3s + src: bin/k3s{{ k3s_architectures[ansible_architecture].arch_suffix }} dest: /usr/local/bin/k3s owner: root group: root