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/< environment name >
. 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?
site.yml
- include: local.yml
local.yml
- hosts: 127.0.0.1
connection: local
vars_files:
- "group_vars/perlservers"
- "group_vars/deploy_list"
group_vars/phl-stage
[webservers]
phl-web1
phl-web2
[perlservers]
phl-perl1
phl-perl2
[phl-stage:children]
webservers
perlservers
Directory structure:
group_vars
all
phl-stage
phl-prod
site.yml
local.yml