# use password lookup together with vault?

**URL:** <https://forum.ansible.com/t/use-password-lookup-together-with-vault/18416>\
**Category:** Ansible Project\
**Created:** [June 5, 2015, 9:45am UTC](https://forum.ansible.com/t/use-password-lookup-together-with-vault/18416 "2015-06-05T09:45:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrich\_Hochholdinger](https://avatars.discourse-cdn.com/v4/letter/u/839c29/32.png) [@Ulrich\_Hochholdinger](https://forum.ansible.com/u/Ulrich_Hochholdinger)\
**Post date:** [June 5, 2015, 9:45am UTC](https://forum.ansible.com/t/use-password-lookup-together-with-vault/18416/1 "2015-06-05T09:45:32Z")

</div>

Hi,  
is it possible to keep the password information generated with the password lookup in a vault-encrypted file?  
I want to generate new random passwords for new machines and keep them idempotent. But the already generated passwords should be kept encrypted in the playbook e.g. as vault-file.  
“lookup password” seems perfect for this. But they are kept clear text, and can’t be encrypted as a vault?

I tried following which does not work:

task in test.yml playbook:

- name: debug  
debug: msg=“{{ lookup(‘password’, ‘passwordfile chars=ascii\_letters length=15 encrypt=sha512\_crypt’) }}”

ansible-playbook -i “myhost,” --vault-password-file /root/.vault test.yml

# passwordfile is generated cleartext

ansible-vault encrypt roles/passwords/files/passwordfile

# passwordfile is now al vault

ansible-playbook -i “myhost,” --vault-password-file /root/.vault test.yml

# passwordfile is simply overwritten with new clear-text data ☹

Anyone a cool solution for this?

Cheers  
Ulli

---

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [June 5, 2015, 10:19am UTC](https://forum.ansible.com/t/use-password-lookup-together-with-vault/18416/2 "2015-06-05T10:19:58Z")

</div>

You might want to look at vault from hashicorp. Drop me a note when your plugin is ready to test 😉
