Interview Prep/Ansible/Security: Vault, Become and Compliance

A CI pipeline needs the vault password without storing it in the repo.

IntermediateScenarioSecurity: Vault, Become and Compliance
Answer

Situation read → Secure delivery to automation.

What I'd do → Store it as a masked CI secret and write it to a temp file or use a script that prints it from a secret manager.

echo "$VAULT_PASS" > "$RUNNER_TEMP/vp" && chmod 600 "$RUNNER_TEMP/vp"
ansible-playbook site.yml --vault-password-file "$RUNNER_TEMP/vp"
shred -u "$RUNNER_TEMP/vp"

A cleaner method: --vault-password-file ./vault-pass.sh where the script fetches from AWS Secrets Manager.

Why → If the file is executable, Ansible runs it and uses stdout.

Interview tip → Never echo the secret in logs; mask it.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance