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/9dd2516a-b7fe-4e67-8bb5-99fb4977b533n%40googlegroups.com.

Reply via email to