Created
July 17, 2018 05:58
-
-
Save jabelk/fc69c30999773f354ebddb1eb37ec961 to your computer and use it in GitHub Desktop.
facts example
This file contains 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
facts = '{"output":{"ansible_facts":{"fan_info":[{"status":"Ok","model":null,"hw_ver":"0.0","name":"ChassisFan1"},{"status":"None","model":null,"hw_ver":"0.0","name":"ChassisFan2"},{"status":"Ok","model":"--","hw_ver":"--","name":"Fan_in_PS1"},{"status":"Failure","model":"--","hw_ver":"--","name":"Fan_in_PS2"}],"hostname":"nxos-spine1","ansible_net_serialnum":"TM6017D760B","platform":"NX-OSv Chassis","ansible_net_all_ipv4_addresses":["10.0.0.71"],"ansible_net_model":"NX-OSv Chassis","ansible_net_hostname":"nxos-spine1","interfaces_list":["mgmt0","Ethernet2/1","Ethernet2/2","Ethernet2/3","Ethernet2/4","Ethernet2/5","Ethernet2/6","Ethernet2/7","Ethernet2/8","Ethernet2/9","Ethernet2/10","Ethernet2/11","Ethernet2/12","Ethernet2/13","Ethernet2/14","Ethernet2/15"],"ansible_net_gather_subset":["hardware","default","interfaces","legacy"],"power_supply_info":[{"status":"Ok","model":"DS-CAC-845W","number":1},{"status":"Absent","model":"------------","number":2}],"ansible_net_interfaces":{"Ethernet2/13":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/12":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/11":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/10":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/15":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/14":{"macaddress":"2cc2.604f.feb2","duplex":"auto","type":"Ethernet","state":"down","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"auto-speed"},"Ethernet2/1":{"macaddress":"2cc2.604f.feb2","duplex":"full","type":"Ethernet","state":"up","mtu":"1500","bandwidth":1000000,"mode":"routed","speed":"1000 Mb/s"}},"ansible_net_version":"7.3(1)D1(1) [build 7.3(1)D1(0.10)]","module":[{"status":"active *","model":"N7K-SUP1","type":"NX-OSv Supervisor Module","ports":0},{"status":"ok","model":"N7K-F248XP-25","type":"NX-OSv Ethernet Module","ports":48},{"status":"ok","model":"N7K-F248XP-25","type":"NX-OSv Ethernet Module","ports":48},{"status":"ok","model":"N7K-F248XP-25","type":"NX-OSv Ethernet Module","ports":48}],"ansible_net_all_ipv6_addresses":[],"ansible_net_memtotal_mb":3908,"ansible_net_filesystems":["bootflash:"],"ansible_net_image":"bootflash:///titanium-d1.7.3.1.D1.0.10.bin","os":"7.3(1)D1(1) [build 7.3(1)D1(0.10)]","vlan_list":[1]}}}' | |
facts_dict = json.loads(facts) | |
{u'output': {u'ansible_facts': {u'fan_info': [{u'status': u'Ok', u'model': None, u'hw_ver': u'0.0', u'name': u'ChassisFan1'}, {u'status': u'None', u'model': None, u'hw_ver': u'0.0', u'name': u'ChassisFan2'}, {u'status': u'Ok', u'model': u'--', u'hw_ver': u'--', u'name': u'Fan_in_PS1'}, {u'status': u'Failure', u'model': u'--', u'hw_ver': u'--', u'name': u'Fan_in_PS2'}], u'ansible_net_model': u'NX-OSv Chassis', u'ansible_net_interfaces': {u'Ethernet2/13': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/12': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/11': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/10': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/15': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/14': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'auto', u'speed': u'auto-speed', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'down', u'mode': u'routed', u'type': u'Ethernet'}, u'Ethernet2/1': {u'macaddress': u'2cc2.604f.feb2', u'duplex': u'full', u'speed': u'1000 Mb/s', u'bandwidth': 1000000, u'mtu': u'1500', u'state': u'up', u'mode': u'routed', u'type': u'Ethernet'}}, u'ansible_net_all_ipv4_addresses': [u'10.0.0.71'], u'ansible_net_hostname': u'nxos-spine1', u'hostname': u'nxos-spine1', u'ansible_net_serialnum': u'TM6017D760B', u'interfaces_list': [u'mgmt0', u'Ethernet2/1', u'Ethernet2/2', u'Ethernet2/3', u'Ethernet2/4', u'Ethernet2/5', u'Ethernet2/6', u'Ethernet2/7', u'Ethernet2/8', u'Ethernet2/9', u'Ethernet2/10', u'Ethernet2/11', u'Ethernet2/12', u'Ethernet2/13', u'Ethernet2/14', u'Ethernet2/15'], u'ansible_net_gather_subset': [u'hardware', u'default', u'interfaces', u'legacy'], u'power_supply_info': [{u'status': u'Ok', u'model': u'DS-CAC-845W', u'number': 1}, {u'status': u'Absent', u'model': u'------------', u'number': 2}], u'platform': u'NX-OSv Chassis', u'ansible_net_version': u'7.3(1)D1(1) [build 7.3(1)D1(0.10)]', u'module': [{u'status': u'active *', u'model': u'N7K-SUP1', u'type': u'NX-OSv Supervisor Module', u'ports': 0}, {u'status': u'ok', u'model': u'N7K-F248XP-25', u'type': u'NX-OSv Ethernet Module', u'ports': 48}, {u'status': u'ok', u'model': u'N7K-F248XP-25', u'type': u'NX-OSv Ethernet Module', u'ports': 48}, {u'status': u'ok', u'model': u'N7K-F248XP-25', u'type': u'NX-OSv Ethernet Module', u'ports': 48}], u'ansible_net_all_ipv6_addresses': [], u'ansible_net_memtotal_mb': 3908, u'ansible_net_filesystems': [u'bootflash:'], u'ansible_net_image': u'bootflash:///titanium-d1.7.3.1.D1.0.10.bin', u'os': u'7.3(1)D1(1) [build 7.3(1)D1(0.10)]', u'vlan_list': [1]}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment