项目作者: ananace

项目描述 :
Support for selectively booting chainloaded iPXE with Foreman
高级语言: Ruby
项目地址: git://github.com/ananace/foreman_ipxe.git
创建时间: 2017-09-01T13:42:39Z
项目社区:https://github.com/ananace/foreman_ipxe

开源协议:MIT License

下载


Foreman iPXE

Adds in PXE loaders for chainloaded iPXE (undionly.kpxe, ipxe.efi)

This is useful for when you want to selectively chainload specific hosts into iPXE without affecting all other machines with the same OS.

Installation

Follow the Foreman manual for advanced installation from gems

For full usage of this plugin, you might want to create at least a global default iPXE boot template.
You can also specify a local boot template if need be, though in the case one is missing then a default template will be rendered that just closes iPXE and lets BIOS/UEFI continue the boot with the next device.

Compatibility

Foreman Version Plugin Version
>= 1.14 ~> 0.1
>= 1.18 ~> 0.2
>= 1.20 merged in Foreman

Usage

Global

This plugin adds global iPXE templates for hosts, if your DHCP is set up to always boot iPXE on all hosts - or hosts have iPXE embedded as their boot software.

You’ll need to create a global default template for iPXE to support this feature, an example given below;

  1. <%#
  2. kind: iPXE
  3. model: ProvisioningTemplate
  4. name: iPXE global default
  5. snippet: false
  6. -%>
  7. #!ipxe
  8. set menu-default local
  9. set menu-timeout 5000
  10. :start
  11. menu iPXE global boot menu
  12. item --key l local Continue local boot
  13. item shell Drop into iPXE shell
  14. item reboot Reboot system
  15. item
  16. item --key d discovery Foreman Discovery
  17. choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
  18. set menu-timeout 0
  19. goto ${selected}
  20. :cancel
  21. echo Menu canceled, dropping to shell
  22. :shell
  23. echo Use the command 'exit' to return to menu
  24. shell
  25. set menu-timeout 0
  26. goto start
  27. :failed
  28. echo Boot failed, dropping to shell
  29. goto shell
  30. :reboot
  31. reboot
  32. :local
  33. exit
  34. :discovery
  35. dhcp
  36. kernel ${next-server}/boot/fdi-image/vmlinuz0 rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=<%= foreman_server_url %> proxy.type=foreman BOOTIF=01-${net0/mac}
  37. initrd ${next-server}/boot/fdi-image/initrd0.img
  38. boot || goto failed
  39. goto start

If you need to set a host-specific iPXE template, you can set the host parameter iPXE_Template to the name of the template that should be rendered for it.

Chainloading

Without DHCP setup

To use the chainloading, you need to generate the iPXE executables first.

  1. git clone git://git.ipxe.org/ipxe.git
  2. cd ipxe/src
  3. cat <<EOF > default.ipxe
  4. #!ipxe
  5. dhcp
  6. chain https://foreman.example.com/unattended/iPXE
  7. EOF
  8. make bin/undionly.kpxe EMBED=default.ipxe
  9. make bin-x86_64-efi/ipxe.efi EMBED=default.ipxe

The generated executables should then be uploaded to the root of your TFTP server (or depending on your root path DHCP option).

With DHCP setup

Install the officially available iPXE executables (undionly.kpxe, ipxe.efi) into your TFTP server, then follow the iPXE guide for “breaking the loop”.

You want to add a rule that passes the bootfile “https://foreman.example.com/unattended/iPXE“ to any client reporting in as user class “iPXE”.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ananace/foreman_ipxe

License

The gem is available as open source under the terms of the MIT License.