2022-04-12 14:08:21 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-09-28 13:22:36 +00:00
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
while true :
|
|
|
|
do
|
|
|
|
ROOT_TOKEN=$(nomad acl bootstrap | awk '/Secret ID/{print $4}')
|
|
|
|
if [ ! -z $ROOT_TOKEN ]; then break; fi
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
set -e
|
|
|
|
|
|
|
|
export NOMAD_TOKEN="$ROOT_TOKEN"
|
|
|
|
|
|
|
|
mkdir -p ../keys
|
|
|
|
echo $NOMAD_TOKEN > "${DIR}/../keys/nomad_root_token"
|
|
|
|
|
|
|
|
# Our default policy after bootstrapping will be full-access. Without
|
|
|
|
# further policy, we only test that we're hitting the ACL code
|
|
|
|
# Tests can set their own ACL policy using the management token so
|
|
|
|
# long as they clean up the ACLs afterwards.
|
|
|
|
nomad acl policy apply \
|
|
|
|
-description "Anonymous policy (full-access)" \
|
|
|
|
anonymous \
|
2020-10-05 13:28:37 +00:00
|
|
|
"${DIR}/anonymous.nomad_policy.hcl"
|