Only one value in a vars file is secret and you want it in the same file as plain values.
BeginnerScenarioSecurity: Vault, Become and Compliance
Answer
Situation read → Inline encryption.
What I'd do →
ansible-vault encrypt_string --vault-id prod@prompt 's3cr3t' --name 'db_password'
Paste the resulting !vault | block into the YAML.
Why → It keeps diffs readable for non-secret lines.
Interview tip → Whole-file encryption hides structure from reviewers; inline shows the keys. Choose by team preference.
More on Security: Vault, Become and Compliance
Database passwords are sitting in plain text in `group_vars`. How do you fix it?BeginnerYou need separate vault passwords for staging and prod.IntermediateHow do you change the vault password for all encrypted files?IntermediateA CI pipeline needs the vault password without storing it in the repo.IntermediateYou want to see the value inside an encrypted file without writing a decrypted copy to disk.BeginnerA task needs root on the target but your user has only limited sudo rights.Intermediate