github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/terraform/scripts/bootstrap-nomad.sh (about) 1 #!/usr/bin/env bash 2 3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 5 while true : 6 do 7 ROOT_TOKEN=$(nomad acl bootstrap | awk '/Secret ID/{print $4}') 8 if [ ! -z $ROOT_TOKEN ]; then break; fi 9 sleep 5 10 done 11 set -e 12 13 export NOMAD_TOKEN="$ROOT_TOKEN" 14 15 mkdir -p ../keys 16 echo $NOMAD_TOKEN > "${DIR}/../keys/nomad_root_token" 17 18 # Our default policy after bootstrapping will be full-access. Without 19 # further policy, we only test that we're hitting the ACL code 20 # Tests can set their own ACL policy using the management token so 21 # long as they clean up the ACLs afterwards. 22 nomad acl policy apply \ 23 -description "Anonymous policy (full-access)" \ 24 anonymous \ 25 "${DIR}/anonymous.nomad_policy.hcl"