# ansible-vault and with\_password

**URL:** <https://forum.ansible.com/t/ansible-vault-and-with-password/17606>\
**Category:** Ansible Project\
**Created:** [February 23, 2015, 11:53pm UTC](https://forum.ansible.com/t/ansible-vault-and-with-password/17606 "2015-02-23T23:53:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![J11](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@J11](https://forum.ansible.com/u/J11)\
**Post date:** [February 23, 2015, 11:53pm UTC](https://forum.ansible.com/t/ansible-vault-and-with-password/17606/1 "2015-02-23T23:53:54Z")

</div>

All,

Looking to automate password / account management using Ansible. The overall goal is to have an unencrypted password in a file for use (so that I have it handy if I need to pull it up) and the nuse ansible-vault or some other mechanism to encrypt the password. There are two says I’d like to approach this:

(a, preferred) Variable file that has plain-text password, such as:  
password:

- user: plain\_text\_password
- user2: plain\_text\_password2

I found a stack overflow link that indicated there would be some way to loop over the variables and then encrypt them one-by-one, finally feeding them into the user module. Unfortunately I can’t get this to work properly. Any thoughts / ideas?

(b) The second method is to store a user password in a file and then use the with\_password mechanism. This works fine until I use ansible-vault to encrypt the password file. Unfortunately the with\_password mechanism will append the salt to the encrypted password file.

Is there a good way to accomplish this goal?

Thanks!
