# ansible-vault encrypt\_string and inventory files

**URL:** <https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [April 4, 2018, 9:23pm UTC](https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189 "2018-04-04T21:23:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 4, 2018, 9:23pm UTC](https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189/1 "2018-04-04T21:23:30Z")

</div>

It will never work in ini file, you can encrypt the whole inventory  
though (yaml or ini).

As for the single var, it 'should' work in a YAML inventory, but i  
don't think we had it as a specific feature.

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [April 4, 2018, 9:52pm UTC](https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189/2 "2018-04-04T21:52:46Z")

</div>

Thx Brian. I deleted my original post (didn’t see a response to it yet, so you probably were responding when I deleted it) due to semi-sensitive information. I will post my general question below for context for people reading this in the future:

Can I utilize the encrypt\_string output in my inventory file (tried multiple ways but couldn’t get it to work):

Sample inventory file:

`  
[win]  
[ansible-win.mydomain.com](http://ansible-win.mydomain.com)  
[win:vars]  
ansible\_connection=winrm  
ansible\_user=ansible  
ansible\_password=“!vault |  
$ANSIBLE\_VAULT;1.1;AES256  
37323038653234633237633336613932313930613332333063356662356636326130626236366536  
6138643739653436613930366165393161613932353865660a333939333666353435653433626536  
36303430386438616234386639386439343433363962363563636436643562613339626536396332  
6364393263646539650a656334373662343438336663666535343130336235616363343332356232  
3238”

`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [April 4, 2018, 11:53pm UTC](https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189/3 "2018-04-04T23:53:38Z")

</div>

my answer still stands, !vault is a YAMLism, it will never work in an INI file.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [April 5, 2018, 4:47am UTC](https://forum.ansible.com/t/ansible-vault-encrypt-string-and-inventory-files/27189/4 "2018-04-05T04:47:08Z")

</div>

Google groups is a mailing list, so when you post, it sends mail to everyone that have subscribed to the list by e-mail.  
So deleting a post won't work since the mail i already sent.
