When i try to use/inoke on another task, i get error as sec_tunnel_ip is
undefined.
On Thursday, July 8, 2021 at 12:22:06 PM UTC+5:30 Charles Daniel wrote:
>
> Team,
>
> I would like to use the variable i got from one ansible task to another
> task where hosts are different.
>
> Please help me use the variable to use it on another task!!
>
> ---
>
> - name: Get the primary router tunnel ip address
> hosts: primary
> gather_facts: false
> connection: local
> tags:
> - "get_sec_tunnel_ip"
> tasks:
> - name: Obtain primary 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 }}
>
> - name: Display router tunnel ip address from this task
> hosts: secondary
> gather_facts: false
> connection: local
> tags:
> - "use_output"
> tasks:
> - name: Display primary tunnel interface ip address
> - debug:
> msg: "{{ sec_tunnel_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/1daafd88-3c14-456a-bb94-e6f7f3ba8748n%40googlegroups.com.