You never need to include group_vars/<groupname> variables in vars_files --
these are loaded automatically.   Ditto for host_vars/<hostname>.

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.




On Tue, May 20, 2014 at 2:43 PM, Samnang Sen <[email protected]> wrote:

> 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?
>
>
> # cat local.yml
> ---
> # file: local.yml
>
> - hosts: 127.0.0.1
>   connection: local
>
>   vars_files:
>     - "group_vars/perlservers"
>     - "group_vars/deploy_list"
>
>
> # cat 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
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a1142fa4-336b-48de-85dc-96a982d5219d%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/a1142fa4-336b-48de-85dc-96a982d5219d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzmK5KprCW8EOJWN5SazqwEKZr2jHu0cAjNQV%2B%2BDhgF0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to