Open bastelfreak opened 8 years ago
This output contains Ruby hashes, another supported output format of facter is yaml and json.
example json output:
{
"augeas": {
"version": "1.4.0"
},
"disks": {
"sda": {
"model": "VIRTUAL DISK",
"size": "931.00 GiB",
"size_bytes": 999653638144,
"vendor": "Dell"
}
},
"dmi": {
"bios": {
"release_date": "09/10/2013",
"vendor": "Dell Inc.",
"version": "1.10.0"
},
"board": {
"manufacturer": "Dell Inc.",
"product": "REMOVED",
"serial_number": ".REMOVED."
},
"chassis": {
"type": "Rack Mount Chassis"
},
"manufacturer": "Dell Inc.",
"product": {
"name": "PowerEdge R210",
"serial_number": "REMOVED",
"uuid": "REMOVED"
}
},
"facterversion": "3.1.4",
"filesystems": "ext2,ext3,ext4",
"identity": {
"gid": 0,
"group": "root",
"uid": 0,
"user": "root"
},
"is_virtual": false,
"kernel": "Linux",
"kernelmajversion": "4.3",
"kernelrelease": "4.3.3-3-ARCH",
"kernelversion": "4.3.3",
"load_averages": {
"15m": 0.05,
"1m": 0.0,
"5m": 0.01
},
"memory": {
"system": {
"available": "7.60 GiB",
"available_bytes": 8158461952,
"capacity": "2.45%",
"total": "7.79 GiB",
"total_bytes": 8363397120,
"used": "195.44 MiB",
"used_bytes": 204935168
}
},
"mountpoints": {
"/": {
"available": "836.72 GiB",
"available_bytes": 898418540544,
"capacity": "8.63%",
"device": "/dev/sda2",
"filesystem": "ext4",
"options": [
"rw",
"relatime",
"data=ordered"
],
"size": "915.79 GiB",
"size_bytes": 983326662656,
"used": "79.08 GiB",
"used_bytes": 84908122112
},
"/boot": {
"available": "434.41 MiB",
"available_bytes": 455508992,
"capacity": "6.30%",
"device": "/dev/sda1",
"filesystem": "ext4",
"options": [
"rw",
"relatime",
"data=ordered"
],
"size": "463.60 MiB",
"size_bytes": 486123520,
"used": "29.20 MiB",
"used_bytes": 30614528
}
},
"networking": {
"dhcp": "10.25.3.2",
"domain": "REMOVED",
"fqdn": "REMOVED",
"hostname": "dhcp01",
"interfaces": {
"eno1": {
"bindings": [
{
"address": "10.30.7.40",
"netmask": "255.255.255.128",
"network": "10.30.7.0"
}
],
"bindings6": [
{
"address": "fe80::5e5b:6c1d:e5:bcac",
"netmask": "ffff:ffff:ffff:ffff::",
"network": "fe80::"
}
],
"dhcp": "10.25.3.2",
"ip": "10.30.7.40",
"ip6": "fe80::5e5b:6c1d:e5:bcac",
"mac": "b8:ac:6f:93:33:f5",
"mtu": 1500,
"netmask": "255.255.255.128",
"netmask6": "ffff:ffff:ffff:ffff::",
"network": "10.30.7.0",
"network6": "fe80::"
},
"eno2": {
"mac": "b8:ac:6f:93:33:f6",
"mtu": 1500
},
"lo": {
"bindings": [
{
"address": "127.0.0.1",
"netmask": "255.0.0.0",
"network": "127.0.0.0"
}
],
"bindings6": [
{
"address": "::1",
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"network": "::1"
}
],
"ip": "127.0.0.1",
"ip6": "::1",
"mtu": 65536,
"netmask": "255.0.0.0",
"netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
"network": "127.0.0.0",
"network6": "::1"
}
},
"ip": "10.30.7.40",
"ip6": "fe80::5e5b:6c1d:e5:bcac",
"mac": "b8:ac:6f:93:33:f5",
"mtu": 1500,
"netmask": "255.255.255.128",
"netmask6": "ffff:ffff:ffff:ffff::",
"network": "10.30.7.0",
"network6": "fe80::",
"primary": "eno1"
},
"os": {
"architecture": "x86_64",
"family": "Archlinux",
"hardware": "x86_64",
"name": "Archlinux",
"release": {
"full": "4.3.3-3-ARCH",
"major": "4",
"minor": "3"
},
"selinux": {
"enabled": false
}
},
"partitions": {
"/dev/sda1": {
"filesystem": "ext4",
"mount": "/boot",
"partuuid": "aea7026b-9d76-4cb1-b4f4-6dcd92625c70",
"size": "487.00 MiB",
"size_bytes": 510656512,
"uuid": "9a3bae59-88fa-4c94-bea2-920b59bd6b64"
},
"/dev/sda2": {
"filesystem": "ext4",
"mount": "/",
"partuuid": "1a90840c-141e-4ced-821a-9b3b7d7196c2",
"size": "930.52 GiB",
"size_bytes": 999139835904,
"uuid": "d7c0a984-65e1-4e2c-88e2-674838ce7be1"
}
},
"path": "/root/.gem/ruby/2.3.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl",
"processors": {
"count": 4,
"isa": "unknown",
"models": [
"Intel(R) Xeon(R) CPU X3430 @ 2.40GHz",
"Intel(R) Xeon(R) CPU X3430 @ 2.40GHz",
"Intel(R) Xeon(R) CPU X3430 @ 2.40GHz",
"Intel(R) Xeon(R) CPU X3430 @ 2.40GHz"
],
"physicalcount": 1
},
"ruby": {
"platform": "x86_64-linux",
"sitedir": "/usr/lib/ruby/site_ruby/2.3.0",
"version": "2.3.0"
},
"ssh": {
"dsa": {
"fingerprints": {
"sha1": "SSHFP 2 1 3ad5b381f238a1b570975e683ae85bc9d83f92f5",
"sha256": "SSHFP 2 2 40183b9bee4d66565fdf45b0d71debe811bdfc52a4fc030f6fb8ef6fdc022178"
},
"key": "AAAAB3NzaC1kc3MAAACBAORSwlNVuhpctLOo9k3tOkBhhgbFUyRystAkVS1pgy5aUii15kOtxnaEYEmB1/iwfSe7j3wJzV+e5n0NTZ72sLsd8o22XJg651DjAnZ08FrxtfulJ8girlAX6o87msvq7ESJakNT+b6uUF2J2IZJBX6H+PUY5sb/kED/O5tGw0VTAAAAFQCWnUtO6U5bNvez12OpH7Up8Np8VwAAAIB3nUC6BSo+nZbOLgVM6aGkQYgOTxMtELd5QCYVwIpyZxGplAAFl2vmAHLLsjF40+pzJ3xy4j3bbPhc9BEzO8V24J1fhWqMr8LEVwVCqFLvndYFPH0O30SW/d9sptI5dinMIS+dbfLDRNcuQlai9DVAIoFSUYij1bVIMd+HO5lsmAAAAIEA08LQKFgtXS7ZiG85dMpSJRa5Y+sq3UiyEoT57RXttpWeRuD70hjFxosIl+Nfm7KSHQgIU50uYGKT4dxu0iQaPy9G3HUmDZy6JLD7S2uqZXt52331JSasA0nQ8ZGddm1/bIzBd5FCeCP06RLWpixjo/0ylcxJkMiPOBUwuwOtH54="
},
"ecdsa": {
"fingerprints": {
"sha1": "SSHFP 3 1 dd2dc632fbb4f1d0e46de6f83c2c41cba0f9499f",
"sha256": "SSHFP 3 2 438277659ef80308cee19f05dc801ae2e5a747d4ac479c4006dbe291b4d609af"
},
"key": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDljyEYGQdnbYdaz9QtZ8Wg6UAXGepjIOjqp1kPSpoN+tFylMARIvr857wZ53RE/c+gARnOJxOeimmDpBjGdcBk="
},
"ed25519": {
"fingerprints": {
"sha1": "SSHFP 4 1 fe2f3d2d47a41c64c7ecccb7bcbc0198d1f78ffd",
"sha256": "SSHFP 4 2 a185d5dedaa0701821840bbb46a16a7d0e571df64a6534cb79a705f5546253a1"
},
"key": "AAAAC3NzaC1lZDI1NTE5AAAAIJ3h8XFpCbc5oBRgC15/a4C7PQi37Iaqf7oD3hbWeYAN"
},
"rsa": {
"fingerprints": {
"sha1": "SSHFP 1 1 00668cd766e5c32b21740cedf8850effbb733f59",
"sha256": "SSHFP 1 2 88a3476c65e867f43ab4e4b71a40a96a8c0ff9a9e127ead141c083c820d27552"
},
"key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC8vn6rNwYCxAvJmThSbp0+Z2n72U7GV4cUWnKC8EjhOHvSdykSWBobwzZK/rFJeZ/IzbLq9cv5TrWh+F3zbF/gDBBNiACZJXPYuw41Y1oCnJfLHUyHj6SqPCWMa3BHgTUDnkeoekGynQsySBlvDhd6IB+1nf6k88r/2ATtlKnuESflV3G+5ueuZNtn2kMjH+YYmlj8iFHPsMTF805Ee4tGegyFOfgWPPJ/XE0Cx2xq4RiNbEl6YLpg4CKe4LDkDD+aqoR/QY6p+HIAAKhZtD38NktzeCCFPtvaX5/5SVd0TJPAyYlZGJcX/NXaLznsm26S2lMswEEUbCpoT7yp6xsL"
}
},
"system_uptime": {
"days": 7,
"hours": 168,
"seconds": 606052,
"uptime": "7 days"
},
"timezone": "CET",
"virtual": "physical"
}
lshw -xml
provides also fancy xml output
There is a puppet module which provides a huge amount of megacli factst that we maybe can use: https://github.com/jhoblitt/puppet-smartd/tree/master/lib/facter
I'm just not sure about the best solution to embed these files into LARS. Fanciest hack: add the repo as a git submodule and copy the needed files during the ISO build process into the airootfs directory.
there are some sweet facts for LLDP.
And foreman uses this to enable lldp at boot: https://github.com/theforeman/foreman-discovery-image/blob/master/root/usr/bin/enable-lldp https://github.com/theforeman/foreman-discovery-image/blob/master/22-discovery.ks#L134
I found a good collection of disk facts, with JBOD and LSI/3Ware/Adaptec support: https://github.com/CygnusNetworks/cygnus-puppet-disk-facter/blob/master/lib/facter/disks.rb
Our image needs to be able to work as a discovery image. we need to determine the built in hardware and report that in a reliable format. I would recommend facter for this because it is fast, supports a wide variety of builtin facts and is easy to extend.
example facter output from a node booted with LARS: