Created
September 27, 2017 17:19
-
-
Save privateip/dd13b5747278ebcb19224ecd591c8632 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This parser will parse the output from 'show running-config' on Cisco NXOS. | |
# | |
# Command: show running-config | |
# Platform: nxos | |
# | |
# Returns: | |
# interfaces: | |
# name: The name of the interface | |
# ipv4: The IPv4 address (if configured) | |
# ipv6: The IPv6 address (if configured) | |
# enabled: Whether or not the interface is administratively enabled | |
# description: The configured interface description | |
# vrf: The interface VRF (if configured) | |
# switchport: Whether or not the interface is configured as switchport | |
# acl_in: The name of in inbound ACL (if configured) | |
# acl_out: The name of the outbound ACL (if configured) | |
# | |
# Example: | |
# - nxos_command: | |
# commands: show interface | |
# register: output | |
# | |
# - set_fact: | |
# interface-config: "{{ output.stdout[0] | parse_cli('interface-config.yaml') }}" | |
# | |
vars: | |
interface: | |
name: "{{ item[0].name }}" | |
ipv4: "{{ item[1].match[0] }}" | |
ipv6: "{{ item[8].match[0] }}" | |
enabled: "{{ item[2] != None }}" | |
description: "{{ item[3].match[0] }}" | |
vrf: "{{ item[4].match[0] }}" | |
switchport: "{{ item[5].match[0] == None }}" | |
acl_in: "{{ item[6].match[0] }}" | |
acl_out: "{{ item[7].match[0] }}" | |
mac_address: "{{ item[9].match[0] }}" | |
keys: | |
interfaces: | |
value: "{{ interface }}" | |
start_block: "^interface .*$" | |
end_block: "^$" | |
items: | |
- "^interface (?P<name>.+)" | |
- "ip address (.+)" | |
- "no shutdown" | |
- "description (.+)" | |
- "vrf member (.+)" | |
- "no switchport" | |
- "ip access-group (.+) in" | |
- "ip access-group (.+) out" | |
- "ipv6 address (.+)" | |
- "mac-address (.+)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment