Skip to content

Instantly share code, notes, and snippets.

@tgross
Created March 31, 2021 17:36
Show Gist options
  • Save tgross/9e8d74fdb7e91b2f5fc743ac7d553fc9 to your computer and use it in GitHub Desktop.
Save tgross/9e8d74fdb7e91b2f5fc743ac7d553fc9 to your computer and use it in GitHub Desktop.
Nomad ACLs setup for development
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ROOT_TOKEN=$(nomad acl bootstrap | awk '/Secret ID/{print $4}')
export NOMAD_TOKEN="$ROOT_TOKEN"
nomad acl policy apply \
-description "Anonymous policy" \
"anon" \
"${DIR}/anonymous-policy.hcl"
nomad acl policy apply \
-description "Operator policy" \
"operator" \
"${DIR}/ops-policy.hcl"
OP_TOKEN=$(nomad acl token create -name="operator" -policy="operator" |
awk '/Secret ID/{print $4}')
ANON_TOKEN=$(nomad acl token create -name="anon" -policy="anon" |
awk '/Secret ID/{print $4}')
echo "root token: $ROOT_TOKEN"
echo "op token: $OP_TOKEN"
echo "anon token: $ANON_TOKEN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment