Skip to content

Instantly share code, notes, and snippets.

@ryanpadilha
Last active December 13, 2022 09:06
Show Gist options
  • Save ryanpadilha/351a4a4f17afdc8eb0d963897b98122a to your computer and use it in GitHub Desktop.
Save ryanpadilha/351a4a4f17afdc8eb0d963897b98122a to your computer and use it in GitHub Desktop.
HashiCorp Nomad installation on Linux x64
#!/bin/bash
#
# Installation of Hashicorp Nomad for deploy process
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/351a4a4f17afdc8eb0d963897b98122a/raw/ -o nomad-install.sh
#
echo "Initializing script for devops - Nomad Hashicorp"
NOMAD_VERSION=0.7.0
#CONSUL_VERSION=1.0.1
sudo mkdir -p /var/wplex/devops
cd /var/wplex/devops
#echo "fetching consul binary for Linux x64..."
#curl -sSL https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip -o consul.zip
echo "fetching nomad binary for Linux x64..."
curl -sSL https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o nomad.zip
# echo "fetching nomad binary for LXC containers..."
# curl -sSL https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64-lxc.zip -o nomad.zip
echo "Installing nomad..."
unzip nomad.zip
sudo install nomad /usr/bin/nomad
sudo mkdir -p /etc/nomad.d
sudo chmod a+w /etc/nomad.d
echo "Installing autocomplete..."
nomad -autocomplete-install
echo "Creating structure for hashicorp-cluster..."
DATA_DIR="/var/wplex/devops/nomad-hashicorp"
if [ ! -d "$DATA_DIR" ]; then
sudo mkdir -p "$DATA_DIR"
echo "Hashicorp directory created: $DATA_DIR"
fi
echo "Cleaning files..."
sudo rm -rf nomad.zip
echo "Done script for devops - Nomad Hashicorp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment