Thank you Vladimir - Much appreciated your response. Unfortunately, I am a 
ansible noob and trying to learn the things for a realtime network 
requirements

If you can help me where the lines you shown here will fit in my script. My 
script is below

    - name: get_ip
      ios_command:
        provider: "{{ cli }}"
        commands: "show ip interface brief {{ item }}"
      register: var_ip_addr

      with_items:
        - gigabitEthernet0/0/0
        - Loopback 0
I have to use var_ip_addr in other places in the script such as configuring 
ACL. 

For example I would look for GigabitEthernet 0/0/0 IP address from the 
var_ip_addr and use it in ACL. Again in the same script i will look for 
Loopback 0 in var_ip_addr and use it to configure router ID.. Just for 
example. 

Can you help me explaining how the instruction you provided will help 
here?  Thanks

regards,RB 


On Friday, May 28, 2021 at 7:43:21 PM UTC+5:30 [email protected] wrote:

> For example
>
> - set_fact:
> interfaces: "{{ interfaces|default({})|
> combine({_arr.0: _arr.1}) }}"
> loop: "{{ var_ip_addr.results|
> json_query('[].stdout_lines') }}"
> vars:
> _arr: "{{ item.0.1.split() }}"
>
> should give
>
> interfaces:
> GigabitEthernet0/0/0: 42.151.182.42
> Loopback0: 172.31.246.246
>
>
> -- 
> Vladimir Botka
>

-- 
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/dfc04a8c-8c05-4ad7-81d2-30d68eb5e88an%40googlegroups.com.

Reply via email to