Without knowing what your 'result' data structure looks like, doing
string matching with IP addressing is almost certainly going to be
problematic.
I assume you don't want to have problems.
So, what does your 'result' data look like?

On Fri, 26 Mar 2021 at 11:37, Devops warrior <[email protected]> wrote:
>
> I'm trying to add new IP address (10.97.6.12) in firewall,  Before adding, 
> I'm validating whether the new IP already exists in firewall or not.
>
> Task:
>      - set_fact:
>             existing: "{{ result | json_query('objects[*].value') |  
> select('match',(  intip )) | list  }}"
>
> output:
> TASK [set_fact] 
> **************************************************************************************************************************************************************task
>  path: /home/palo-test/json.yml:32
> ok: [192.168.0.40] => {
>     "ansible_facts": {
>         "existing": [
>             "10.96.6.120",
>             "10.96.6.125"
>         ]
>     },
>     "changed": false
> }
>
> Regex in set_fact is considering existing Ip objects 10.96.6.120 and 
> 10.96.6.125 as 10.96.6.12. Need help to matching the exact IP.
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/245eea94-ae74-4fa1-b55e-2d121f42cc9dn%40googlegroups.com.



-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwM3MxJM4Qn00znOp-ft4hKhBrbxtbwivE_hOYt6Wfg3Dg%40mail.gmail.com.

Reply via email to