
上QQ阅读APP看书,第一时间看更新
How it works...
We run this new playbook against all nodes within the core and wan group, and we use the ios_facts module to collect the information from the managed IOS devices. In this recipe, we use the debug module to print out the information that was collected from the ios_facts module. The following is a subset of the information that was discovered:
ok: [core01 -> localhost] => {
"Ansible_facts": {
"net_all_ipv4_addresses": [
"172.20.1.20",
< ---------- Snippet ------------ >
"10.1.100.1"
],
"net_hostname": "core01",
"net_interfaces": {
< ---------- Snippet ------------ >
"Vlan10": {
"bandwidth": 1000000,
"description": null,
"duplex": null,
"ipv4": [
{
"address": "10.1.10.1",
"subnet": "24"
}
],
"lineprotocol": "up",
"macaddress": "aabb.cc80.e000",
"mediatype": null,
"mtu": 1500,
"operstatus": "up",
"type": "Ethernet SVI"
},
},
"net_iostype": "IOS",
"net_serialnum": "67109088",
"net_system": "ios",
"net_version": "15.1",
}
< ------------ Snippet ------------ >
}
From the preceding output, we can see some of the main facts that the ios_facts module has captured from the devices, including the following:
- net_all_ipv4_addresses: This list data structure contains all the IPv4 addresses that are configured on all the interfaces on the IOS device.
- net_interfaces: This dictionary data structure captures the status of all of the interfaces on this device and their operational state, as well as other important information, such as a description and their operational state.
- net_serialnum: This captures the serial number of the device.
- net_version: This captures the IOS version running on this device.