# Accessing encrypted variables fails

**URL:** <https://forum.ansible.com/t/accessing-encrypted-variables-fails/23314>\
**Category:** Ansible Project\
**Created:** [December 21, 2016, 10:05pm UTC](https://forum.ansible.com/t/accessing-encrypted-variables-fails/23314 "2016-12-21T22:05:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgb205](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pgb205](https://forum.ansible.com/u/pgb205)\
**Post date:** [December 21, 2016, 10:05pm UTC](https://forum.ansible.com/t/accessing-encrypted-variables-fails/23314/1 "2016-12-21T22:05:09Z")

</div>

I have a playbook that executes several commands that require variable input.  
So far I have done the following.  
Created encrypted yml file in /etc/ansible/secrets folder with the format  
pass\_1: ‘string’  
pass\_2: ‘string’

in the playbook I reference these variables as

- name such and such task  
command: util\_program -p {{ pass\_1 }}

playbook is being run as:

ansible-playbook -i ansible\_inventory playbook\_name.yml --ask-vault-pass

this asks me for vault password which it takes but turns up an error that pass\_1 variable is not defined

I’m not sure if this is because the format of the password file is not correct or if i need to explicitly specify location to ansible-playbook?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 22, 2016, 5:36pm UTC](https://forum.ansible.com/t/accessing-encrypted-variables-fails/23314/2 "2016-12-22T17:36:17Z")

</div>

/etc/ansible/secrets has no meaning to Ansible, it won’t import it automatically. So, yes, you need to specify it in your playbook.
