Thanks a lot, Dick Visser, I just wanted to access it, even with a dummy hostname is ok. let me try that.
Thanks, Charles Daniel On Thu, 8 Jul 2021 at 12:53, Dick Visser <[email protected]> wrote: > > https://stackoverflow.com/questions/39207616/if-set-fact-is-scoped-to-a-host-can-i-use-dummy-host-as-a-global-variable-map > > > On Thu, 8 Jul 2021 at 09:21, Dick Visser <[email protected]> wrote: > >> Those variables are scoped to a host, so they're not available to other >> hosts. >> A common trick is to assign them to a dummy host and access them that >> way. >> >> On Thu, 8 Jul 2021 at 08:53, Charles Daniel <[email protected]> >> wrote: >> >>> 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 >>> <https://groups.google.com/d/msgid/ansible-project/1daafd88-3c14-456a-bb94-e6f7f3ba8748n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Sent from a mobile device - please excuse the brevity, spelling and >> punctuation. >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAL8fbwN1k60EiF-BivFqsdPRQvDAHy9D4X3yWjV6BPKesJyvGA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAL8fbwN1k60EiF-BivFqsdPRQvDAHy9D4X3yWjV6BPKesJyvGA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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%3DhKZm9ADvV9cxNyW%3Dd4nDj_rPu1v_08wHi1RKkv5SVqFWg%40mail.gmail.com.
