A good way to do this is to define two inventory files but put all
production servers in a production group ALSO and all stage servers in a
stage group.

This allows the following:

inventory/production
inventory/stage
inventory/group_vars/all
inventory/group_vars/production
inventory/group_vars/stage

and just -i inventory/production

OR

-i inventory/stage






On Wed, Apr 2, 2014 at 2:58 PM, Kalman Speier <[email protected]>wrote:

> Hi,
>
> I have a repository with the same structure as the best 
> practices<http://docs.ansible.com/playbooks_best_practices.html#directory-layout>
>  in the
> docs, with two inventory files (staging and production).
> My question is that how can I control the differences between those
> environments (stage vs prod) with group variables?
>
> I know I can place vars into the inventory file, but I'm curious if there
> any nicer way to do this?
> Also the docs 
> says<http://docs.ansible.com/intro_inventory.html#splitting-out-host-and-group-specific-data>:
> "The preferred practice in Ansible is actually not to store variables in
> the inventory file."
>
> So I'm wondering is there any other solution, like having a
> "group_vars/staging.yml" for example or anything else?
>
> Many thanks,
> Kalman Speier
>
>  --
> 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/2c20826d-6627-4dad-b0d8-4a982fbf95cf%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/2c20826d-6627-4dad-b0d8-4a982fbf95cf%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/CAEVJ8QO9aDDFvsKhssLjTvuM797PDoY%3DBp%3DMOhSHitvesRC-cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to