# Encrypt part of an inventory

**URL:** <https://forum.ansible.com/t/encrypt-part-of-an-inventory/26472>\
**Category:** Ansible Project\
**Created:** [January 12, 2018, 4:50pm UTC](https://forum.ansible.com/t/encrypt-part-of-an-inventory/26472 "2018-01-12T16:50:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DK1](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@DK1](https://forum.ansible.com/u/DK1)\
**Post date:** [January 12, 2018, 4:50pm UTC](https://forum.ansible.com/t/encrypt-part-of-an-inventory/26472/1 "2018-01-12T16:50:46Z")

</div>

Hi,

I have a number of different inventory like the following. Each inventory will have variables for different usernames & passwords

> all:
> 
> children:
> 
> A:
> 
> hosts:
> 
> minion1:
> 
> ansible\_host: 10.134.47.102
> 
> minion2:
> 
> ansible\_host: 10.134.47.103
> 
> minion3:
> 
> ansible\_host: 10.134.47.104
> 
> vars:
> 
> username: someuser
> 
> password: somepassword
> 
> ansible\_ssh\_user: someotheruser
> 
> ansible\_ssh\_pass: someotherpassword

Instead of including the variables here is there a way to pass a separate encrypted file?

> ansible-playbook playbook-create-template.yml -i inventory.yml joes-secrets.yaml

Or is there a cleaner way to use Vault and just have placeholder in the inventory like {{ VAULT\_JOES\_PASSWORD }}  
If so, how best to create the vault without calling ansible-vault encrypt\_string password123 --ask-vault-pass for each individual username & password?
