Case Study: Vault Secrets¶
Section status: outline
This case study is scoped but not yet written in full prose. The sections below define what it will cover.
Problem¶
A database password needs to reach a production playbook without ever existing in plaintext in the repository, in shell history, or in CI logs.
What It Will Cover¶
ansible-vault encrypt_stringto produce a single encrypted value inline in an otherwise-plaintextgroup_vars/production.yml- Separate
--vault-id prod@promptvs.--vault-id staging@promptso a staging vault-password leak can't decrypt production secrets - CI configuration: the vault password itself sourced from the CI system's own secret store, never committed, referenced via
--vault-password-filepointing at a runtime-generated file no_log: trueon the task that consumes the decrypted value, and confirming with-vvvthat the secret never appears in output even at high verbosity
Interview Questions¶
- How would you structure vault passwords so a staging compromise can't expose production secrets?
- Where does the vault password itself live in a CI pipeline, if it can't be committed?
Next¶
Continue to Dynamic Inventory Case Study.