Skip to content

Commit

Permalink
[ansible] Set up for more general architecture support (#3438)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Nov 8, 2024
1 parent d70d5a5 commit 7f23e66
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
10 changes: 5 additions & 5 deletions deploy/ansible/playbook_k3s_airgapped_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
1 change: 1 addition & 0 deletions deploy/ansible/roles/container_engine/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ container_packages:
- containerd.io

keyring_location: /etc/apt/keyrings
cpu_arch: amd64
2 changes: 1 addition & 1 deletion deploy/ansible/roles/container_engine/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions deploy/ansible/roles/container_images/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

source_image_dir: ../airgap-images
airgap_image_dir: /var/lib/rancher/k3s/agent/images
cpu_arch: amd64
13 changes: 9 additions & 4 deletions deploy/ansible/roles/container_images/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions deploy/ansible/roles/helm_install/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 3 additions & 4 deletions deploy/ansible/roles/helm_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions deploy/ansible/vars/k3s_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
k3s_version: "v1.30.1%2Bk3s1"
kubectl_version: "v1.30.2"
helm_version: "v3.15.2"
cpu_arch: "amd64"

0 comments on commit 7f23e66

Please sign in to comment.