What is the error, and what does the 'ip_addr' variable look like?

On Sat, 22 Jun 2019 at 11:43, Pandu jh <jhpa...@gmail.com> wrote:
>
> I tried below tasks but it's giving error on regex task.
> Can you help me to get the pattern to filter only the item starts with the 
> alphabet.
>
>       - set_fact:
>           ip_list:  "{{ ip_addr.split(\n) | ipaddr }}"
>       - debug:  var=ip_list
>       - set_fact:
>           host_list:  "{{ ip_addr.split(\n) |  regex_search('^[a-z].*')  }}"
>       - debug:  var=host_list
>
>
>
>
> On Saturday, 22 June 2019 04:33:09 UTC+5:30, Dick Visser wrote:
>>
>> You should be able to use a regular expression to filter hostnames
>>
>> On Fri, 21 Jun 2019 at 16:54, Pandu jh <jhp...@gmail.com> wrote:
>>>
>>> I have a variable that contains short hostname, FQDN and IP addresses.
>>> I need to filter sort hostname/FQDNs and it should store to a variable and 
>>> also IP addresses should store to an another variable(this am able to do 
>>> using ipaddr)
>>> Please help me to filter hostnames and store to a variable.
>>>
>>> system:  >
>>>   1.1.1.1
>>>    myhost.example.com
>>>    myhost
>>>
>>> --
>>> 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 ansible...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/5c7f4d91-3427-44fb-a63c-ed42681b8403%40googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> Sent from a mobile device - please excuse the brevity, spelling and 
>> punctuation.
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/e228de95-7f97-40a8-8b96-7a50eef53855%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwO-gpqSMpWLiAV3OXh8C%3DPxqup%2BQUzEYCVZE1yV0fy1QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to