-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_interfaces.yml
38 lines (27 loc) · 939 Bytes
/
show_interfaces.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
---
# This is a playbook for Ansible using network-engine with "show interfaces" parser.
- hosts: unknown
roles:
- ansible-network.network-engine
tasks:
- name: Run 'show interfaces'
ios_command:
commands:
- show interfaces
register: output
# - name: Display the output
# debug: var=output.stdout
- name: Parse the output
command_parser:
file: "parsers/ios/show_interfaces_parser.yml"
content: "{{ output.stdout[0] }}"
# - name: Display the data
# debug: var=interfaces_facts
- name: Delete '/tmp/interfaces_facts-[inventory_hostname].json'
file:
path: "/tmp/interfaces_facts-{{ inventory_hostname }}.json"
state: absent
- name: Write interfaces_facts to '/tmp/interfaces_facts-[inventory_hostname].json'
copy:
content: "{{ interfaces_facts | to_nice_json }}"
dest: "/tmp/interfaces_facts-{{ inventory_hostname }}.json"