How Do You Get ansible-vault to Prompt You for a Password to Encrypt a File That You Create?

Problem scenario
You are using the ansible-vault command.  You are not being prompted for a password as the documentation suggests you would be.  You want to use ansible-vault create or ansible-vault edit and be prompted for a password. How can you specify a password manually?  How can someone on a different Ansible server decrypt your encrypted files?  

Possible solution #1
Modify the ansible.cfg file. Comment out a stanza like this:

# vault_password_file = ~/.vault_pass.txt

If there is no leading pound "#" mark, add one to comment it out.

Possible solution #2
Upgrade or downgrade Ansible from 2.4.  There is a documented bug about this.

Possible solution #3
When you run ansible-vault, use this flag: --ask-vault-pass

Here is an example:  ansible-vault create contint.yml --ask-vault-pass

Leave a comment

Your email address will not be published. Required fields are marked *