You can make a group called db_servers_stage and db_servers_production if
you like.  Put hosts in each.

[stage:children]
dbservers_stage
webservers_stage

[dbservers:children]
dbservers_stage
dbservers_production

etc




On Thu, Aug 28, 2014 at 4:31 AM, Jordi Funollet <[email protected]>
wrote:

>  On Thu, Aug 28, 2014, at 04:03 AM, Brian Coca wrote:
> > hosts can be in more than one group. all hosts in the production file
> > should be in production group, but you can also have hosts in dbservers
> > group.
>
> Agree. So when targeting hosts we can use the inventory as environment and
> *--limit* to restrict to a specific group in this environment.
>
>   $ ansible-playbook -i inventory/stage -l dbservers
>
> But what about vars? Both vars in *group_vars/stage* and
> *group_vars/dbservers* would apply for these hosts. But I can't see a way
> to set a value for *dbservers* in *stage*  and another for *dbservers* in*
> production*. Most cases could be addressed without this level of
> granularity, but I would like to know if there's some way to achieve this.
>
> And which one takes precedence? I assume groups are sorted alphabetically
> (are they?) so we should use some naming trick to guarantee that
> environments vars are consistently selected after (or before) "regular
> groups" vars.
>
>   $ python -c 'import string ; print "".join(sorted(string.printable))'
>
>   !"#$%&'()*+,-./0123456789:;<=>?@
>   ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
>
> Prepending *~* to environment names sounds like a good way to give them
> less weight than "regular groups".
> --
> Jordi Funollet Pujol
> http://www.linkedin.com/in/jordifunollet
>
>
> --
> 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/1409214674.1310501.157687269.4E51BB12%40webmail.messagingengine.com
> <https://groups.google.com/d/msgid/ansible-project/1409214674.1310501.157687269.4E51BB12%40webmail.messagingengine.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%2BnsWgzz%2BB6Wx%2BaZ0TY%2BAo9N%2BRmvgY9SZk3AR%2Boz-oB8b-96LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to