0

Requirement using Ansible is:

> 1.Connect to the router first.

> 2.Then push debug commands to the router.(using ansible playbook)

> 3.Ansible will wait for few seconds because router will take some time to dump the output on the monitor screen(CLI of router).

> 4.Then gather all that debug logs from the Router to the controller and save it in text file.

Question is: What module to use for gathering this debug output using ansible?

I hope this time requirement is quite clear and comprehensive.

$$ Also,I can use 'show log' and gather the data but my requirement is to gather all that output which the router dumps on the screen(CLI).

Note: When we enable debugs on router and "logging monitor debugging" is enabled then logs will be printed on the screen not in buffer.How to save these debugs in a variable ??

---
- name: Gathering outputs from single hosts
  hosts: network 
  connection: local
  gather_facts: True
  tasks:
  - name: Pushing debug commands 
    ios_command:
      commands:
        - debug ip packet detail
        - term mon
  - pause: 
      seconds: 5
  - name: Gathering debugs
    ios_command:
      commands:
        - show ip int brief
        - show log

    register: print_output

  -  debug: var=print_output.stdout_lines

/etc/ansible$ cat hosts 
[local]
127.0.0.1
[network]
2.2.2.2
Drvy AWe
  • 1
  • 3

0 Answers0