Question with group_vars

In my local.yml I’m able to run the playbook and reference variables within group_vars/all however I’m not able to access variables within group_vars/phl-stage. Let’s assume the following.

ansible-playbook -i phl-stage site.yml

I have a variable, let’s call it “deploy_path” that’s different for each environment. I place the variable within group_vars/. If I include the file (group_vars/phl-stage) within “vars_files” it works but I would’ve thought the group file would be automatically loaded?

cat local.yml

You never need to include group_vars/ variables in vars_files – these are loaded automatically. Ditto for host_vars/.

The paths looked at those alongside your playbook or inventory.

If you want to put them somewhere else, you can be explicit, but I would not call them “group_vars” as that means something in ansible and might confuse anyone reading it why you had the duplication.