You should have some form of inventory groups for development, testing and production.
Timothy Appnel Principal Architect Ansible by Red Hat +1 718.404.6429 | <+1+718.404.6429> ansible.com <https://www.ansible.com/> GitHub: tima <https://www.github.com/tima> Twitter: @appnelgroup <https://www.twitter.com/@appnelgroup> On Mon, Mar 14, 2016 at 4:42 PM, Gilberto Valentin <[email protected]> wrote: > I have a couple of systems that follow a strict hostname schema. For > example, depending on the environment, they all follow the same prefix for > that environment: > > - For development = dev-server1.domain.tld > - For testing = test-server1.domain.tld > - For production = prod-server1.domain.tld > > Using Ansible's *setup *module, I know I can call the hostname with a > variable of *facter_hostname*. However, how do I use that variable value > to compare it with a list of environments like the one above so that if the > hostname has the prefix of *dev*, then assign a value of 1; if it > contains a prefix of *test*, then assign it a value of 2; if it has a > prefix of *prod*, then assign it a value of 3. > > -- > 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/333f046b-bdd3-48c8-919e-0b7037ebf3a2%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/333f046b-bdd3-48c8-919e-0b7037ebf3a2%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/CAOMCme4ozyWo7kV2Jjw8eZu5isw2PndHdRJHU2DvZUGUUd8w-g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
