You're sending only the output of the debug task with the regex_search
applied to the output.stdout variable.
We need to see the output.stdout variable before you mangled it.

On Thu, 8 Jul 2021 at 09:56, Charles Daniel <[email protected]> wrote:
>
> One more help needed, When I try to do regex to get the ip output, it comes 
> along with the unicode characters such as - [u'
> how to eliminate it while grepping it through regex_search itself.
>
> Actual output: "- [u'172.16.121.6']\n"
>
> I want it to be(expected): 172.16.121.6
>
>
>   - name: Obtain secondary tunnel interface ip address
>     ios_command:
>       commands:
>         - "show interface tunnel1 | sec Internet address"
>     register: output
>   - debug:
>       msg: "{{ output.stdout}}"
>   - set_fact:
>       intf: |
>           - {{output.stdout | 
> map('regex_search','(([0-9]+(.)[0-9]+(.)[0-9]+(.)[0-9]+))') | list }}
>     register: sec_tunnel_ip
>   - debug:
>        msg={{ sec_tunnel_ip }}
>
>
> Output:
> ********
>
> TASK [debug] 
> ******************************************************************************************************
> ok: [172.16.12.1] => {
>     "msg": {
>         "ansible_facts": {
>             "intf": "- [u'172.16.121.6']\n"
>         },
>         "changed": false,
>         "failed": false
>     }
> }
>
> Thanks,
> Charles Daniel
>
> --
> 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/CAPnV%3Dh%2B7LxPqEnbrezq3Maofib9Ak8UmLUsK10twE0DeqXKBPw%40mail.gmail.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/CAL8fbwPitsJ0-RyoEdfUWJkV%3DBusc8y7gx8r_YnB1YuvDwuCeQ%40mail.gmail.com.

Reply via email to