Created
March 31, 2021 17:36
-
-
Save tgross/9e8d74fdb7e91b2f5fc743ac7d553fc9 to your computer and use it in GitHub Desktop.
Nomad ACLs setup for development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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