-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiosshowcommands.yml
102 lines (85 loc) · 2.61 KB
/
iosshowcommands.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
- name: Capture show output
hosts: all
gather_facts: false
connection: network_cli
tasks:
- name: show run
ios_command:
commands:
- show version
- show inventory
- show run
- show clock
- show cdp neighbors
- show inter counters error
- show inter counter
- show int status
- show int description
- show int trunk
- show spanning-tree summary
- show spanning-tree root
- show vlan brief
- show mac address-table aging-time
- show mac address-table dynamic
- show ip arp
- show ip int brief vrf all
- show ip int brief
- show hsrp brief
- show ip route summary
- show ip route | i 00:0
- show ip eigrp neighbors
- show ip mroute summary
- show logg
register: config
- name: show 2
ios_command:
commands:
- show lldp neighbors
ignore_errors: true
register: config2
- name: show 3
ios_command:
commands:
- show ip cef
ignore_errors: true
register: config3
- name: show 4
ios_command:
commands:
- show fex
ignore_errors: true
register: config4
- name: show 5
ios_command:
commands:
- show port-chan summary
ignore_errors: true
register: config5
- name: save output to local directory
copy:
content: "{{ config.stdout | replace('\\n', '\n') }}"
dest: "/home/ansiblereports/show-output/{{ inventory_hostname }}.ios"
- name: append new line EOF 2
blockinfile:
path: "/home/ansiblereports/show-output/{{ inventory_hostname }}.ios"
insertafter: EOF
block: "{{ config2.stdout | replace('\\n', '\n') }}"
when: config2.stdout is defined
- name: append new line EOF 3
blockinfile:
path: "/home/ansiblereports/show-output/{{ inventory_hostname }}.ios"
insertafter: EOF
block: "{{ config3.stdout | replace('\\n', '\n') }}"
when: config3.stdout is defined
- name: append new line EOF 4
blockinfile:
path: "/home/ansiblereports/show-output/{{ inventory_hostname }}.ios"
insertafter: EOF
block: "{{ config4.stdout | replace('\\n', '\n') }}"
when: config4.stdout is defined
- name: append new line EOF 5
blockinfile:
path: "/home/ansiblereports/show-output/{{ inventory_hostname }}.ios"
insertafter: EOF
block: "{{ config5.stdout | replace('\\n', '\n') }}"
when: config5.stdout is defined