Interview Prep/Ansible/Security and Secrets

How do you handle the vault password in CI/CD?

IntermediateProductionSecurity and Secrets
Answer

Store it in the CI system's secret store (masked, scoped to protected branches) and write it to a file or FIFO only for the job's duration.

umask 077
printf '%s' "$ANSIBLE_VAULT_PW" > "$RUNNER_TEMP/.vp"
ansible-playbook site.yml --vault-password-file "$RUNNER_TEMP/.vp"
rm -f "$RUNNER_TEMP/.vp"

A better pattern is an executable password script that fetches the password from a secrets manager using the runner's identity (OIDC), so no static secret lives in CI. Use different vault IDs per environment so a dev pipeline cannot decrypt prod.

All Ansible questions Roadmap: Ansible

More on Security and Secrets