Skip to content

Commit

Permalink
Print ACL token first
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Mar 1, 2024
1 parent f149ea2 commit 45b60f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nomad-acl-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ until nomad acl policy list > /dev/null; do
sleep 1; done;

NOMAD_TOKEN="$(nomad acl bootstrap | tail -n +2 | head -n 1 | awk '{print $4}')"

# Print the token to stdout
echo "Nomad ACL Secret ID = $NOMAD_TOKEN"

export NOMAD_TOKEN=$NOMAD_TOKEN

# Write NOMAD_TOKEN as a local file
echo "$NOMAD_TOKEN" >> "/etc/nomad.d/token"

# .bashrc: Add a step to read the token from the local file
cat <<< 'export NOMAD_TOKEN=$(sudo cat /etc/nomad.d/token)' >> "$HOME/.bashrc"

# Print the token to stdout
echo "Nomad ACL Secret ID = $NOMAD_TOKEN"

0 comments on commit 45b60f8

Please sign in to comment.