Skip to content

Instantly share code, notes, and snippets.

@NilashishC
Last active January 17, 2024 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NilashishC/b3c33a5d6d99fdc7170117cdbe13833b to your computer and use it in GitHub Desktop.
Save NilashishC/b3c33a5d6d99fdc7170117cdbe13833b to your computer and use it in GitHub Desktop.
Playbook:
=============
---
- hosts: nxos
gather_facts: true
gather_subset: interfaces
tasks:
- name: Gather interface resource facts
cisco.nxos.nxos_facts:
gather_network_resources: interfaces
- name: Display gathered facts
ansible.builtin.debug:
var: ansible_facts
NOTE:
1. The output has `net_interfaces` which is coming from `gather_facts: true` + `gather_subset: interfaces`.
2. The output also has `network_resources` and `interfaces` subkey under it, which is from the first "Gather interface resource facts" task.
Output:
========
ok: [nxos-10-3-1] =>
ansible_facts:
net_all_ipv4_addresses:
- 192.168.255.147
net_all_ipv6_addresses:
- fd5d:12c9:2201:2::1/64
net_api: cliconf
net_gather_network_resources:
- interfaces
net_gather_subset:
- default
net_hostname: nexus9300-10-3-1
net_image: bootflash:///nxos64-cs.10.3.1.F.bin
net_interfaces:
Ethernet1/1:
bandwidth: '10000000'
duplex: auto
macaddress: 5200.46bb.1b08
mtu: '1500'
speed: auto-speed
state: down
type: 100/1000/10000 Ethernet
Ethernet1/2:
bandwidth: '10000000'
duplex: auto
macaddress: 5200.46bb.1b08
mtu: '1500'
speed: auto-speed
state: down
type: 100/1000/10000 Ethernet
Ethernet1/3:
bandwidth: '10000000'
duplex: auto
macaddress: 5200.46bb.1b08
mtu: '1500'
speed: auto-speed
state: down
type: 100/1000/10000 Ethernet
mgmt0:
bandwidth: '65535000'
duplex: unknown enum:<0>
ipv4:
address: 192.168.255.147
masklen: '24'
macaddress: 5254.0000.46bb
mtu: '1500'
speed: unknown enum:<65535>
state: up
type: Ethernet
port-channel10:
bandwidth: '100000'
duplex: auto
macaddress: 0000.0000.0000
mode: access
mtu: '1500'
speed: auto-speed
state: down
type: Port-Channel
port-channel11:
bandwidth: '100000'
duplex: auto
macaddress: 0000.0000.0000
mode: access
mtu: '1500'
speed: auto-speed
state: down
type: Port-Channel
net_license_hostid: 9YWC5XOS197
net_model: Nexus9000 C9300v Chassis
net_neighbors:
mgmt0:
- host: ios.ansible.lab
port: GigabitEthernet0/3
sysname: ios.ansible.lab
net_platform: N9K-C9300v
net_python_version: 3.12.0
net_serialnum: 9Q5FBNLHDOO
net_system: nxos
net_version: 10.3(1)
network_resources:
interfaces:
- mode: layer2
name: port-channel10
- mode: layer2
name: port-channel11
- name: Ethernet1/1
description: "This is test interface Ethernet1/1"
- name: Ethernet1/2
- name: Ethernet1/3
- name: mgmt0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment