Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support discovery image #18

Open
bastelfreak opened this issue Jan 27, 2016 · 6 comments
Open

Support discovery image #18

bastelfreak opened this issue Jan 27, 2016 · 6 comments

Comments

@bastelfreak
Copy link
Member

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.

  • Which data do we need?
  • How do we determine it?

example facter output from a node booted with LARS:

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 => squashfs
identity => {
  gid => 0,
  group => "root",
  uid => 0,
  user => "root"
}
is_virtual => false
kernel => Linux
kernelmajversion => 4.2
kernelrelease => 4.2.5-1-ARCH
kernelversion => 4.2.5
load_averages => {
  15m => 0.05,
  1m => 0.23,
  5m => 0.1
}
memory => {
  system => {
    available => "7.69 GiB",
    available_bytes => 8262098944,
    capacity => "1.21%",
    total => "7.79 GiB",
    total_bytes => 8363507712,
    used => "96.71 MiB",
    used_bytes => 101408768
  }
}
mountpoints => {
  /run/archiso/sfs/airootfs => {
    available => "0 bytes",
    available_bytes => 0,
    capacity => "100%",
    device => "/dev/loop0",
    filesystem => "squashfs",
    options => [
      "ro",
      "relatime"
    ],
    size => "301.50 MiB",
    size_bytes => 316145664,
    used => "301.50 MiB",
    used_bytes => 316145664
  }
}
networking => {
  fqdn => "archiso",
  hostname => "archiso",
  interfaces => {
    eno2 => {
      mac => "b8:ac:6f:97:7e:78",
      mtu => 1500
    },
    eth0 => {
      bindings => [
        {
          address => "10.30.7.41",
          netmask => "255.255.255.128",
          network => "10.30.7.0"
        }
      ],
      bindings6 => [
        {
          address => "fe80::baac:6fff:fe97:7e77",
          netmask => "ffff:ffff:ffff:ffff::",
          network => "fe80::"
        }
      ],
      ip => "10.30.7.41",
      ip6 => "fe80::baac:6fff:fe97:7e77",
      mac => "b8:ac:6f:97:7e:77",
      mtu => 1500,
      netmask => "255.255.255.128",
      netmask6 => "ffff:ffff:ffff:ffff::",
      network => "10.30.7.0",
      network6 => "fe80::"
    },
    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.41",
  ip6 => "fe80::baac:6fff:fe97:7e77",
  mac => "b8:ac:6f:97:7e:77",
  mtu => 1500,
  netmask => "255.255.255.128",
  netmask6 => "ffff:ffff:ffff:ffff::",
  network => "10.30.7.0",
  network6 => "fe80::",
  primary => "eth0"
}
os => {
  architecture => "x86_64",
  family => "Archlinux",
  hardware => "x86_64",
  name => "Archlinux",
  release => {
    full => "4.2.5-1-ARCH",
    major => "4",
    minor => "2"
  },
  selinux => {
    enabled => false
  }
}
partitions => {
  /dev/loop0 => {
    backing_file => "/run/archiso/bootmnt/arch/x86_64/airootfs.sfs",
    filesystem => "squashfs",
    mount => "/run/archiso/sfs/airootfs",
    size => "301.44 MiB",
    size_bytes => 316080128
  },
  /dev/sda1 => {
    filesystem => "ext4",
    partuuid => "0dbaede7-01",
    size => "931.00 GiB",
    size_bytes => 999651541504,
    uuid => "7518ffb3-7b29-42c0-992c-4f9097fa68a4"
  }
}
path => /root/.gem/ruby/2.2.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/sbin:/bin:/sbin
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
}
ssh => {
  dsa => {
    fingerprints => {
      sha1 => "SSHFP 2 1 9fff86f8bcf740de72cda331a9ec2f08c574bebd",
      sha256 => "SSHFP 2 2 426913fb46577b9b0e50698021073d2168c817a210adb6eba409e41bf082ba63"
    },
    key => "AAAAB3NzaC1kc3MAAACBAJYiCLR2bFHofn9vPh+V8mgpnbINW/sQB+H3b15ihajmE1OoFz0/+KTWb62a2kIXPCU/2LxOuuLCWqAoWnXM1OIabYHVssy3J+GLQBS+3it30NsMfn7ap7FkNA8IutTNxhfQk+3ZBPIqTM7MCaw4azT+A5as2c6eWuqonHkchBwHAAAAFQDUPwTQgKNUp4tQBjmAjY9oAURdnQAAAIEAkK+d+LAAoNFp4e5meMagqBD6t0NVH9Tg6rCwQFLyOdJXLCQPI4MjGYfjWakWyLUwD9KihmKb2caJErxGv7MBnes5Ld13Lr+xsrk39iVUn9+MQ2bfJ6FDdIpXCH2XAQmBGfk19Y0VIVNm6TW+uu7oE574/r/4nXp9c8fglyIhdZgAAACAGf+CCKK/kQUu4N4WyXmVXlh2TS9leyD2PNp+xHQ5cyMlKxB8XYMfR+1f2f0DwrVuoLNrzuZ1xWPWAoaf8FnOFNmlmrk1HQNsWN00RBR9IB6w1yt3CN3u56XCnn5JlL/LvpSHurdyIMazRh/8lg2RdyhHC3B1R0RECT8Jin3osYs="
  },
  ecdsa => {
    fingerprints => {
      sha1 => "SSHFP 3 1 af1d2fbf70345d65da8a5740ce30ab0d2003558f",
      sha256 => "SSHFP 3 2 d07d06c97e6a62bbdb81b6a6d5994b882018adf81e3e5e78f35639b66bb4f887"
    },
    key => "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLbNskWyBwi/n3yFmQTOZRG0nJEpGA/qjFBs9TslrT3Nqa3xHWOUXwBJObaESLyrdaImUz55uI4ce5jQTmGWZ7w="
  },
  ed25519 => {
    fingerprints => {
      sha1 => "SSHFP 4 1 4a526ae0f1ab96a59cbb9f2f9487a73149fac25b",
      sha256 => "SSHFP 4 2 85d61bf53f18c4d8b2e9f02e189b490a23cdf3ef00861ef19b5e390df5fb76be"
    },
    key => "AAAAC3NzaC1lZDI1NTE5AAAAIOiTR4KFn86R9fbAbL5AOMGf3gNRyZL68XfK3wNIjfAa"
  },
  rsa => {
    fingerprints => {
      sha1 => "SSHFP 1 1 04e82a2470d6914e77e36c210dcf029075859270",
      sha256 => "SSHFP 1 2 d256a79b2df4326ba4564ee784e47a1e264449d7a3acb5dd2d8dde4c7860dbad"
    },
    key => "AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Ww8M7eIzZZs+PDXa5P9Z3SJzeH8DdBndp+OEZ4eSEkX6K6bxoQMrXxR9MVxnThFMIUyE9eku6BIX4vEF57grXnpbt2eFpuVjOwPPPSXu+c0fSs/sqjl2oECAC1WYD9MEaTv730AaYF6VnXG0LHg8p3HQcQSjjizZuQgJCd/W6qw4KD80IG8DXHaL4aDQGJY9xRLWg0fVKLyWkj+MQLXOpvqHL362vZbXITCeQDJRk2DXTngoFjs0wmsXeje+FIRk9NLQ08clyGew45EEZkQT0hwHNlnSmBmbisRUo3hfi7Y20KZckkdsqwGE7roDRYCxb5eGSNADFaMk78gCROux"
  }
}
system_uptime => {
  days => 0,
  hours => 0,
  seconds => 240,
  uptime => "0:04 hours"
}
timezone => CET
virtual => physical
@bastelfreak
Copy link
Member Author

This output contains Ruby hashes, another supported output format of facter is yaml and json.

@bastelfreak
Copy link
Member Author

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"
}

@bastelfreak
Copy link
Member Author

lshw -xml provides also fancy xml output

@bastelfreak
Copy link
Member Author

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.

@bastelfreak
Copy link
Member Author

@bastelfreak
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant