group_vars/ directories are the best way to do this in many cases. Create a parent group that contains 'database' and 'apache' and apply the variables there.
On Fri, Jul 11, 2014 at 2:57 PM, James Cammarata <[email protected]> wrote: > Put them in a separate file and use the include_vars module: > > http://docs.ansible.com/include_vars_module.html > > You can use when: statements with that. > > > > On Thu, Jul 10, 2014 at 5:39 PM, Steve Lee <[email protected]> wrote: > >> Is it possible to have condition statement on variable? What would be the >> best way to assign Variable based on inventory group? Below is the basic >> idea. >> >> vars: >> epic: true >> when: inventory_hostname == groups.database or inventory_hostname == >> groups.apache >> >> vars: >> epic: false >> when: inventory_hostname != groups.database or inventory_hostname != >> groups.apache >> >> -- >> 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/587e9f49-f9e4-4310-afc3-137c0bd9c5dd%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/587e9f49-f9e4-4310-afc3-137c0bd9c5dd%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/CAMFyvFjKjx1jixSdGP%2BMwWscAaBr4T1fKgiv%2Bk%3D%2B6DLnUU2XPA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAMFyvFjKjx1jixSdGP%2BMwWscAaBr4T1fKgiv%2Bk%3D%2B6DLnUU2XPA%40mail.gmail.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%2BnsWgwT4K3eivJ6_q6by%3DCdpfah_7RKP3EjNY2zinJt0zO%3DKg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
