group_vars not visible to playbook

Hi,

It’s seemed that variables defined in the group_vars are not visible to playbooks. Then where should I keep the those variables?
Here is what I’m trying to do:

directory tree:

You cant't define something that points to the inventory (hosts: in the
play) with something that comes from the inventory (group_vars)​. That
would create a black hole.

I felt that. Then is there a way to define variable which can be used in the position of the mentioned “var1” in foo.yml ? Is the command line options (i.e., -e) is the only way ?

​I believe so yes. Not sure if there's a way to use a var from var: of
vars_files: section, but maybe if set in a previous play.​

If you want to pass in the host specifier, you’ll need to use “-e”. Or maybe a lookup plugin reading an environment variable. -e is a bit clear.

-e @filename.yml is also a valid syntax.

If you want to pass in the host specifier, you’ll need to use “-e”. Or maybe a lookup plugin reading an environment variable. -e is a bit clear.

-e @filename.yml is also a valid syntax.

Ok, I see. Thanks for mentioning the @filename.yml syntax also.