# How to secure Ansible Vault password?

**URL:** <https://forum.ansible.com/t/how-to-secure-ansible-vault-password/21425>\
**Category:** Ansible Project\
**Created:** [May 12, 2016, 8:49pm UTC](https://forum.ansible.com/t/how-to-secure-ansible-vault-password/21425 "2016-05-12T20:49:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foss\_Geek](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@Foss\_Geek](https://forum.ansible.com/u/Foss_Geek)\
**Post date:** [May 12, 2016, 8:49pm UTC](https://forum.ansible.com/t/how-to-secure-ansible-vault-password/21425/1 "2016-05-12T20:49:10Z")

</div>

Hi All,

In my environment I am automatically triggering ansible-playbook with in bash script like below(not possible to give password in interactive prompt). I am storing the vault password in plain text file in the file system and deleting it after deployment. But I don’t want to store plain password in file system.

```auto
# ansible-playbook site.yml --vault-password-file ~/.vault_pass.txt

```

```auto
What is the best way to secure vault password and pass it automatically with out any manual intervention?

```

```auto
Any help will be really appreciated.

```

```auto
Thanks

```

```auto
Mohan L

```

```auto
 

```

```auto
 

```

```auto

```

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [May 13, 2016, 9:12am UTC](https://forum.ansible.com/t/how-to-secure-ansible-vault-password/21425/2 "2016-05-13T09:12:28Z")

</div>

Well…

You can set a location for your vault password file in your ansible.cfg

```auto
vault_password_file = /path/to/vault_password_file

```

You can also use a python script that generates and returns the password to STDOUT instead of just having the password in a plain text file.

[http://docs.ansible.com/ansible/playbooks\_vault.html#running-a-playbook-with-vault](http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault)

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![pixel\_fairy](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@pixel\_fairy](https://forum.ansible.com/u/pixel_fairy)\
**Post date:** [May 15, 2016, 11:06pm UTC](https://forum.ansible.com/t/how-to-secure-ansible-vault-password/21425/3 "2016-05-15T23:06:10Z")

</div>

You can use gnupg to encrypt the passphrase to vault to yourself and whoever else needs it without sharing or knowing their passphrases. [http://benincosa.com/?p=3235](http://benincosa.com/?p=3235)

when trying it, i found this useful too, [http://sudoers.org/2013/11/05/gpg-agent.html](http://sudoers.org/2013/11/05/gpg-agent.html)
