# Editing inline encrypted variables?

**URL:** <https://forum.ansible.com/t/editing-inline-encrypted-variables/28330>\
**Category:** Ansible Project\
**Created:** [August 14, 2018, 5:34pm UTC](https://forum.ansible.com/t/editing-inline-encrypted-variables/28330 "2018-08-14T17:34:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [August 14, 2018, 5:34pm UTC](https://forum.ansible.com/t/editing-inline-encrypted-variables/28330/1 "2018-08-14T17:34:25Z")

</div>

Hi

I've come to like the inline encrypted variable  
([https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_vault.html#single-encrypted-variable](https://docs.ansible.com/ansible/latest/user_guide/playbooks_vault.html#single-encrypted-variable))  
as this is handy for instance with larger data structures that only  
contain one of two sensitive values.

Management of those values is quite a pain however. It usually  
includes manually copying the encrypted string to a new file, fix the  
indentation, then running ansible-vault on the file.

Editing plain files is easy, editing encrypted files is also easy.  
Is there maybe some (vi) plugin that lets you edit the inline  
encrypted vars in a more user friendly way?

Thanks!

Dick

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [August 15, 2018, 3:10pm UTC](https://forum.ansible.com/t/editing-inline-encrypted-variables/28330/2 "2018-08-15T15:10:12Z")

</div>

One solution to the inconvienince of changing the inline vault variable is to use prefix the vault variable with vault\_ and store the actual secret data in a file. Then reference the vault variable with vault\_xxx. This way when you can use ansible-vault edit/view etc but still make the variable searchable via grep(i.e. you get the benefit from both approaches)

Here are some links with more description.  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_best\_practices.html#variables-and-vaults](https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#variables-and-vaults)

A more detail write up  
[https://www.digitalocean.com/community/tutorials/how-to-use-vault-to-protect-sensitive-ansible-data-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-use-vault-to-protect-sensitive-ansible-data-on-ubuntu-16-04)

Tony Chia
