Read down of page <https://docs.ansible.com/playbooks_filters.html#other-useful-filters>.
On Tuesday, June 2, 2015 at 2:27:23 PM UTC+6, Max wrote: > > Thanks for the response. > The goal is to match a regular expression and then use the value matched > for doing other things. Just testing whether a particular string is present > or not doesn't suffice for me. > http://example.com:90/xyz > http://dual.com.87/yjhh > My script should fetch me the host name by using a regex from any of the > urls in the format specified above. > > On Tuesday, June 2, 2015 at 1:52:14 PM UTC+5:30, Шалыгин Константин wrote: >> >> - name: Debug >> debug: msg='facter_fqdn is {{ facter_fqdn }}' >> register: 'debug_result' >> - name: Fail >> fail: msg='Sample warning when fqnd != fqdn' >> when: facter_fqdn.find == "{{ facter_fqdn }}" >> - name: Fail >> fail: msg='Sample warning when fqdn %like% example.com' >> when: facter_fqdn.find('example.com') != -1 >> - name: Fail >> fail: msg='Sample warning when fqdn %like% localdomain' >> when: facter_fqdn.find('.local') != -1 >> >> >> >> On Tuesday, June 2, 2015 at 1:23:04 PM UTC+6, Max wrote: >>> >>> Suppose I've url=http://example.com:90/url and now in my ansible task I >>> want to get the url variable by {{ url }} and then do a regex match and >>> fetch oly the hostname i.e. example.com. >>> Any directions on how this can be achieved would help. >>> >> -- 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/663f1803-b701-4e5e-8aec-32252d317d03%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
