Thanks for the info Matt. I Don't have DNS configured and hence even 'ansible_fqdn' is giving me random stuff. For time being I've fixed it with 'group['groupname']' to iterate over my group and do some regex matching.
--------------- Max On Wednesday, March 25, 2015 at 9:51:17 PM UTC+5:30, Matt Martz wrote: > > I imagine the problem is that ansible_hostname is the portion of the fqdn. > hostname before the first dot. You will likely want to look at > ansible_fqdn instead. > > If you run the setup module against a host, you should be able to look at > all of the facts to find the appropriate fact names. > > On Wed, Mar 25, 2015 at 5:01 AM, Max <[email protected] <javascript:>> > wrote: > >> Hello >> >> Here are the two scenarios: >> 1) This one works: >> when: ansible_hostname | search("test1-1-xx-1") >> 2)This one is not able to match the string probably because of dots >> when: ansible_hostname | search("test1-1-xx-1.tom.com") >> I even tried escapting dots with a backslash without any success. >> >> Any help would be appreciated. >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/a24a16eb-3a70-458d-a217-f3c56612581d%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/a24a16eb-3a70-458d-a217-f3c56612581d%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Matt Martz > @sivel > sivel.net > -- 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/72e9f7e7-af80-4f9e-be4e-37fbb810499e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
