commit 7f36c5f31878561c4ac081aec23950f99e6e77b5
parent 26665e287fa0c4790fcc29c2aac3192528f6cfe6
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Mon, 28 Jul 2025 18:57:47 +0200
feat: add architecture variable
Diffstat:
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
@@ -30,7 +30,7 @@ apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y jq podman cloud-init curl \
"nomad=${NOMAD_VERSION}-1"
-curl -L -o openbao.deb "https://github.com/openbao/openbao/releases/download/v${BAO_VERSION}/bao_${BAO_VERSION}_linux_arm64.deb"
+curl -L -o openbao.deb "https://github.com/openbao/openbao/releases/download/v${BAO_VERSION}/bao_${BAO_VERSION}_linux_${ARCHITECTURE}.deb"
apt install ./openbao.deb
# Configure insecure local registry
diff --git a/hashi-pi.pkr.hcl b/hashi-pi.pkr.hcl
@@ -139,6 +139,11 @@ variable "bao_version" {
default = "2.2.2"
}
+variable "architecture" {
+ type = string
+ default = "arm64"
+}
+
packer {
required_plugins {
qemu = {
@@ -200,7 +205,7 @@ source "qemu" "hashiintel" {
shutdown_command = "echo 'debian' | sudo -S shutdown -P now"
ssh_timeout = "15m"
ssh_username = "in0rdr"
- ssh_private_key_file = "/home/andi/.ssh/id_rsa"
+ ssh_private_key_file = "/home/andi/.ssh/id_ed25519"
vm_name = "${var.hostname}.qcow2"
}
@@ -210,6 +215,7 @@ build {
provisioner "shell" {
script = "bootstrap.sh"
environment_vars = [
+ "ARCHITECTURE=${var.architecture}",
"HOSTNAME=${var.hostname}",
"USERNAME=${var.username}",
"AUTHORIZED_KEYS=${var.authorized_keys}",
@@ -240,6 +246,7 @@ build {
script = "nomad.sh"
remote_folder = "/home/${var.username}"
environment_vars = [
+ "ARCHITECTURE=${var.architecture}",
"USERNAME=${var.username}",
"NFS_SERVER=${var.nomad_nfs_server}",
"NFS_MOUNT=${var.nomad_nfs_mount}",
@@ -268,6 +275,7 @@ build {
script = "openbao.sh"
remote_folder = "/home/${var.username}"
environment_vars = [
+ "ARCHITECTURE=${var.architecture}",
"USERNAME=${var.username}",
"HOSTNAME=${var.hostname}",
"NOMAD_SERVER=${var.nomad_server}",
diff --git a/hosts/intel0.pkrvars.hcl b/hosts/intel0.pkrvars.hcl
@@ -1,3 +1,4 @@
+architecture = "amd64"
hostname = "intel0"
img_name = "HashiIntel0.img"
nomad_server = true
diff --git a/nomad.sh b/nomad.sh
@@ -11,8 +11,8 @@ cd "/home/${USERNAME}"
# Install podman driver for Nomad
# https://developer.hashicorp.com/nomad/plugins/drivers/community/containerd
-curl -LO "https://releases.hashicorp.com/nomad-driver-podman/${NOMAD_PODMAN_DRIVER_VERSION}/nomad-driver-podman_${NOMAD_PODMAN_DRIVER_VERSION}_linux_arm64.zip"
-unzip "nomad-driver-podman_${NOMAD_PODMAN_DRIVER_VERSION}_linux_arm64.zip"
+curl -LO "https://releases.hashicorp.com/nomad-driver-podman/${NOMAD_PODMAN_DRIVER_VERSION}/nomad-driver-podman_${NOMAD_PODMAN_DRIVER_VERSION}_linux_${ARCHITECTURE}.zip"
+unzip "nomad-driver-podman_${NOMAD_PODMAN_DRIVER_VERSION}_linux_${ARCHITECTURE}.zip"
mkdir -p /opt/nomad/plugins/
mv nomad-driver-podman /opt/nomad/plugins/
@@ -191,7 +191,7 @@ sed -i 's/$/ cgroup_enable=memory/' /boot/cmdline.txt
# Install CNI plugins
# - https://developer.hashicorp.com/nomad/docs/networking/cni
-curl -L -o cni-plugins.tgz "https://github.com/containernetworking/plugins/releases/download/v1.6.2/cni-plugins-linux-arm64-v1.6.2.tgz"
+curl -L -o cni-plugins.tgz "https://github.com/containernetworking/plugins/releases/download/v1.6.2/cni-plugins-linux-${ARCHITECTURE}-v1.6.2.tgz"
mkdir -p /opt/cni/bin
tar -C /opt/cni/bin -xzf cni-plugins.tgz