Skip to content

Latest commit

 

History

History
100 lines (76 loc) · 7.25 KB

File metadata and controls

100 lines (76 loc) · 7.25 KB

Ansible Role jm1.cloudy.pxe_hwfp

This role helps with fingerprinting and reporting the hardware of systems which can be booted via PXE.

Suppose you have a rack with several servers and want to get their specifications, e.g. MAC addresses of NICs and serial numbers of SSDs and HDDs. Once this role and its dependencies have been run, you power on the first system, wait for it to boot via PXE, to automatically fingerprint the hardware with the hwfp script, to report it to the hwfp service and to finally poweroff the system. Once powered off you power on the next system, wait for it to poweroff and continue until all systems are done. Then, on the host which executed this role (and runs hwfp service), you go to directory /var/lib/hwfp and find all system specifications in sub directories where each sub directory has the specs of a single system. For example, this includes the output of dmesg, find /dev, ipmitool, ip addr, ip link, lshw, lsmod and lspci. Directory names consists of timestamps, indicating when the hwfp service received the specs and indicating to you which system has which specification, e.g. lowest timestamp has specs of first booted system etc.

⚠️ WARNING: Do not expose the hwfp service to external networks or the internet. It has no authentication mechanism, transport security or security hardening. It is only meant to be run on internal networks. :warning:

Tested OS images

Available on Ansible Galaxy in Collection jm1.cloudy.

Requirements

This role uses module(s) from collection jm1.pkg. To install this collection you may follow the steps described in README.md using the provided requirements.yml.

Variables

Name Default value Required Description
distribution_id depends on operating system false List which uniquely identifies a distribution release, e.g. [ 'Debian', '10' ] for Debian 10 (Buster)
pxe_hwfp_daemon_host undefined true IP address on which the hwfp service will listen
pxe_hwfp_daemon_group nogroup false UNIX group that the hwfp service is executed as
pxe_hwfp_daemon_port 8000 false TCP port on which the hwfp service will listen
pxe_hwfp_daemon_user hwfp false UNIX user that the hwfp service is executed as
pxe_hwfp_distribution_filename_map { x86_64: { UEFI: 'hwfp/amd64/debian-installer/amd64/bootnetx64.efi', BIOS: 'hwfp/amd64/pxelinux.0' } } false Path for use in filename parameter of dhcpd.conf so that PXE clients know where to find bootable files on the tftp server
pxe_hwfp_files_amd64 https://deb.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/netboot/netboot.tar.gz false Where to download Debian's netboot files which will be used to boot BIOS based systems with PXELINUX and UEFI based systems with GRUB2
pxe_hwfp_kernel_parameters '' false Additional kernel parameters which will be passed to the kernel when booting via PXE to run the hwfp script
pxe_hwfp_tftpd_root depends on distribution_id false Base path which is served by tftpd, e.g. /srv/tftp on Debian and /var/lib/tftpboot on Red Hat Enterprise Linux
pxe_hwfp_virtualenv /opt/hwfp_venv/ false Base path where the Python environment for and with the hwfp service is installed to

Dependencies

Name Description
jm1.cloudy.dhcpd Installs a dhcpd service which is required to publish the next-server which PXE clients use to find the tftp server. This role is optional.
jm1.cloudy.tftpd Installs a tftpd service which is required during PXE network boot to load e.g. the kernel and initrd files and then run the hwfp script. This role is optional.
jm1.pkg.setup Installs necessary software for module jm1.pkg.meta_pkg from collection jm1.pkg. This role is called automatically, manual execution is NOT required.

Example Playbook

For a complete example on how to configure dhcpd, tftpd and hwfp services, refer to host lvrt-lcl-session-srv-300-hwfp-server-debian11 from the provided examples inventory. Additionally, hosts lvrt-lcl-session-srv-310-hwfp-client-debian11-bios and lvrt-lcl-session-srv-311-hwfp-client-debian11-uefi can be booted manually (once provisioned with Ansible) to showcase and debug the whole poweron-fingerprint-report-poweroff cycle. The top-level README.md describes how hosts can be provisioned with playbook playbooks/site.yml.

For instructions on how to run Ansible playbooks have look at Ansible's Getting Started Guide.

License

GNU General Public License v3.0 or later

See LICENSE.md to see the full text.

Author

Jakob Meng @jm1 (github, galaxy, web)