commit c570c3821bb6e41f462fef41b90cc14205d8e702
parent fc5b5436a2328a5037b1cb482275845990d804db
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Tue,  8 Feb 2022 11:23:31 +0100
fix(#5): remove nomad_binary_path
Diffstat:
3 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
@@ -7,9 +7,10 @@ A RaspberryPi test cluster for HashiCorp Vault and Nomad with Consul storage bac
 ## ARM Builder 
 These Packer files use the [Packer builder for ARM](https://github.com/mkaczanowski/packer-builder-arm). Follow the instructions in the repo to setup the builder and use the provided [examples](https://github.com/mkaczanowski/packer-builder-arm/tree/master/boards) to modify to your liking.
 
-## Install Custom Nomad Binary
 
-Copy the [pre-built binary](https://github.com/in0rdr/nomad-arm6l) for the target architecture to the `./bin/nomad` path. The binary file can have an arbitrary name, it need not be set to "nomad". Then, in the Packer JSON, set the `nomad_binary_path` to the relative path of the file, e.g., `nomad_binary_path='./bin/nomad'`. Then, the custom binary is used in the installation stage for Nomad (provisionier [`nomad.sh`](./nomad.sh)) in place of the binary from the [HashiCorp release page](releases.hashicorp.com/nomad/).
+## Supported Architectures
+
+ARM >= ARMv7
 
 ## Self-signed TLS Certificates
 ### Consul
diff --git a/hashi-pi.json b/hashi-pi.json
@@ -14,7 +14,6 @@
     "consul_tls_certs": null,
     "consul_retry_join": "\"HashiPi0\", \"HashiPi1\", \"HashiPi2\"",
     "nomad_version": "1.2.3",
-    "nomad_binary_path": "./bin",
     "nomad_arch": "arm",
     "nomad_nfs_server": "",
     "nomad_nfs_mount": "",
@@ -115,18 +114,12 @@
       ]
     },
     {
-      "type": "file",
-      "source": "./bin",
-      "destination": "/home/{{ user `username` }}/"
-    },
-    {
       "type": "shell",
       "script": "nomad.sh",
       "remote_folder": "/home/{{ user `username` }}",
       "environment_vars": [
         "USERNAME={{ user `username` }}",
         "NOMAD_VERSION={{ user `nomad_version` }}",
-        "NOMAD_BINARY_PATH={{ user `nomad_binary_path` }}",
         "NOMAD_ARCH={{ user `nomad_arch` }}",
         "NFS_SERVER={{ user `nomad_nfs_server` }}",
         "NFS_MOUNT={{ user `nomad_nfs_mount` }}",
diff --git a/nomad.sh b/nomad.sh
@@ -11,23 +11,18 @@ NOMAD_URL="https://releases.hashicorp.com/nomad"
 
 cd "/home/${USERNAME}"
 
-if [[ "$NOMAD_BINARY_PATH" != "./bin" ]]; then
-  # Use custom binary from previous file provisioner
-  mv "$NOMAD_BINARY_PATH" ./nomad
-else
-  # Download Nomad binary and checksums
-  curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_${NOMAD_ARCH}.zip"
-  curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS"
-  curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS.sig"
-
-  # Verify signature and zip archive
-  gpg --import "hashicorp.asc"
-  gpg --verify  "nomad_${NOMAD_VERSION}_SHA256SUMS.sig" "nomad_${NOMAD_VERSION}_SHA256SUMS"
-  sha256sum -c "nomad_${NOMAD_VERSION}_SHA256SUMS" --ignore-missing
-
-  # Extract binary
-  unzip "nomad_${NOMAD_VERSION}_linux_${NOMAD_ARCH}.zip"
-fi
+# Download Nomad binary and checksums
+curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_${NOMAD_ARCH}.zip"
+curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS"
+curl -sS -O "${NOMAD_URL}/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS.sig"
+
+# Verify signature and zip archive
+gpg --import "hashicorp.asc"
+gpg --verify  "nomad_${NOMAD_VERSION}_SHA256SUMS.sig" "nomad_${NOMAD_VERSION}_SHA256SUMS"
+sha256sum -c "nomad_${NOMAD_VERSION}_SHA256SUMS" --ignore-missing
+
+# Extract binary
+unzip "nomad_${NOMAD_VERSION}_linux_${NOMAD_ARCH}.zip"
 
 # Fix ownership and install binary
 chown root: nomad