github.com/hernad/nomad@v1.6.112/e2e/terraform/scripts/bootstrap-nomad.sh (about)

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