# ansible-valult encrypt\_string and adhoc command usage - how to ?

**URL:** <https://forum.ansible.com/t/ansible-valult-encrypt-string-and-adhoc-command-usage-how-to/26755>\
**Category:** Ansible Project\
**Created:** [February 16, 2018, 12:04am UTC](https://forum.ansible.com/t/ansible-valult-encrypt-string-and-adhoc-command-usage-how-to/26755 "2018-02-16T00:04:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narahari\_n\_Savitha](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Narahari\_n\_Savitha](https://forum.ansible.com/u/Narahari_n_Savitha)\
**Post date:** [February 16, 2018, 12:04am UTC](https://forum.ansible.com/t/ansible-valult-encrypt-string-and-adhoc-command-usage-how-to/26755/1 "2018-02-16T00:04:51Z")

</div>

Friends:

I am trying to understand how to do something. I am not even sure it is possible. Try to help me please.

Thank you in advance for your help.

End User types in user id and password on jenkins screen.

I then want to encrypt that password with vault and write that to a file say /tmp/coolCucumber.yml (coolCucumbers encrypted password)

This way I can use that encrypted file at other places I need it.

I later on want to use the ansible adhoc command like this

ansible all -i “[preditserver.ntd.bip.com](http://preditserver.ntd.bip.com)” -m shell -a “ls -ltr” --extra-vars=“ansible\_password=${coolCucumberPassword}” --vault-password-file=/tmp/vault

Will this work ?

-N

---

<div class="post-metadata">

**Author:** ![Narahari\_n\_Savitha](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Narahari\_n\_Savitha](https://forum.ansible.com/u/Narahari_n_Savitha)\
**Post date:** [February 28, 2018, 4:02am UTC](https://forum.ansible.com/t/ansible-valult-encrypt-string-and-adhoc-command-usage-how-to/26755/2 "2018-02-28T04:02:21Z")

</div>

Any help or pointers is appreciated.
