# vars\_files cannot see register variables or variables set in group\_vars, but can see one set from the command line when import\_playbook used (v2.4)

**URL:** <https://forum.ansible.com/t/vars-files-cannot-see-register-variables-or-variables-set-in-group-vars-but-can-see-one-set-from-the-command-line-when-import-playbook-used-v2-4/25224>\
**Category:** Ansible Project\
**Created:** [August 10, 2017, 6:19pm UTC](https://forum.ansible.com/t/vars-files-cannot-see-register-variables-or-variables-set-in-group-vars-but-can-see-one-set-from-the-command-line-when-import-playbook-used-v2-4/25224 "2017-08-10T18:19:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pa\_S](https://avatars.discourse-cdn.com/v4/letter/p/a9a28c/32.png) [@Pa\_S](https://forum.ansible.com/u/Pa_S)\
**Post date:** [August 10, 2017, 6:19pm UTC](https://forum.ansible.com/t/vars-files-cannot-see-register-variables-or-variables-set-in-group-vars-but-can-see-one-set-from-the-command-line-when-import-playbook-used-v2-4/25224/1 "2017-08-10T18:19:08Z")

</div>

Hello:

I’m trying to dynamically set which vault I’m using (don’t want my test environment to use real passwords!).

So I set up this in a play book that I’m doing an import\_playbook from a different directory.

If vault\_file is set from the ansible-playbook command line, this works. If I set the vault\_file from a group vars file from the calling playbook’s dir, vault\_file doesn’t exist from for the vars\_files a statement’s viewpoint. If I set it in a fact vault\_file also doesn’t exist from the vars\_files viewpoint.

But oddly enough, if I debug vault\_file in the debug role, it prints out correctly in all three cases.

Bug, or feature? And how do I work around this?
