Anything you do to HashiCorp Vault twice should be automated. This walks the path from a manual install to a repeatable, pipeline-driven setup.
1. Install it reproducibly
docker run --cap-add=IPC_LOCK -p 8200:8200 -e VAULT_DEV_ROOT_TOKEN_ID=root hashicorp/vault
export VAULT_ADDR=http://127.0.0.1:8200 VAULT_TOKEN=root
vault status2. Describe the desired state
Enable KV, write a secret, and define a least-privilege policy.
vault secrets enable -path=secret kv-v2
vault kv put secret/app/db password=s3cr3t
cat <<EOF | vault policy write app -
path "secret/data/app/*" { capabilities = ["read"] }
EOF3. Run it from CI
Pull a secret in CI with the Vault CLI (auth via OIDC/JWT).
- run: |
export VAULT_TOKEN=$(vault write -field=token auth/jwt/login role=ci jwt=$CI_JOB_JWT)
export DB_PASS=$(vault kv get -field=password secret/app/db)Want senior help putting HashiCorp Vault to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.