diff --git a/nomad-bootstrap.sh b/nomad-bootstrap.sh new file mode 100755 index 0000000..debf278 --- /dev/null +++ b/nomad-bootstrap.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Nomad Bootstrap Script +# Params: +# client : bootstraps as client + +# exit on error +set -e + +# create nomad dir +mkdir -p /opt/nomad + +# create nomad user +useradd --system --home /etc/nomad.d --shell /bin/false nomad + +nomaduser=nomad +nomadgroup=nomad + +if [ "$#" -eq 1 ] && [ "$1" == "-client" ]; then + echo "bootstraping as nomad client" + nomaduser=root + nomadgroup=root +fi + + +# write systemd conf +cat >/etc/systemd/system/nomad.service </etc/nomad.d/nomad.hcl </etc/nomad.d/server.hcl </etc/nomad.d/client.hcl <