ansible-vault encrypt --vault-password-file .vault_pass group_vars/prod.yml

Category: IaC & Automation

ansible-vault encrypt --vault-password-file .vault_pass group_vars/prod.yml

Encrypt a plaintext file using a password file

Encrypts group_vars/prod.yml in place, reading the password from the .vault_pass file instead of prompting, which suits scripts and CI. Keep the password file itself out of version control with tight permissions. Related: ansible-vault decrypt group_vars/prod.yml.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.