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)

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?