This article was originally published on the Red Hat Customer Portal. The information may no longer be current.

Satellite 6.2 introduced PXE-less discovery which is targeted to networks without PXE or DHCP services available. In this workflow, kernel on discovered nodes is replaced (via kexec technology) instead of rebooting. This turns out to be useful feature on PXE/DHCP networks as well.

To configure kexec on PXE/DHCP enabled network, do the following simple steps.

Step 1: Verify foreman discovery image version

Newer version of foreman-discovery-image must be used in order to send required "discovery_kexec" fact. We are planning rebase of foreman-discovery-image package in Satellite 6.2 upcoming errata. In the meantime, it is possible to download upstream version which is based on CentOS 7 rather than Red Hat Enterprise Linux. Series 3.4 are known to work with Satellite 6.2.

tftp_capsule# cd /var/lib/tftpboot/boot/
tftp_capsule# wget http://downloads.theforeman.org/discovery/releases/3.4/fdi-image-3.4.1.tar
tftp_capsule# tar -xvf fdi-image-3.4.1.tar

Step 2: Configure foreman discovery image kernel options

Satellite will either reboot or kexec discovered node based on presence of special fact called "discovery_kexec". When present and KExec template is associated with given Hostgroup and Operating System, kexec is performed. Reboot is the fallback mechanism if the two requirements are not met.

In Hosts - Provisioning templates search for "global" string and edit "PXELinux global default" template. In Satellite 6.2 it is possible to directly edit this template, in upcoming version this template must be cloned and Global setting must be changed to use the cloned template instead the default one.

ONTIMEOUT discovery_upstream
...
LABEL discovery_upstream
  MENU LABEL Foreman Discovery Image 3.4.1
  KERNEL boot/fdi-image/vmlinuz0
  APPEND initrd=boot/fdi-image/initrd0.img 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=https://CAPSULE_URL:9090 proxy.type=proxy fdi.pxfactname1=discovery_kexec fdi.pxfactvalue1=1
  IPAPPEND 2

Change proxy.url and proxy.type accordingly to point to either Satellite Server or Capsule. Note the options fdi.pxfactname1=discovery_kexec fdi.pxfactvalue1=1 which are required in order to have the "discovery_kexec" fact sent along.

Now click on Build PXE Default to rebuild pxelinux.cfg/default template. Hosts can be discovered now.

Step 3: Modify Red Hat KExec template

Find Red Hat Kexec template, clone it, associate it with requied Operating System and edit its contents:

<%#
kind: kexec
name: Red Hat kexec
oses:
- CentOS 4
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 19
- Fedora 20
- Fedora 21
- Fedora 22
- RedHat 4
- RedHat 5
- RedHat 6
- RedHat 7
-%>
<%
  mac = @host.facts['discovery_bootif']
  bootif = '00-' + mac.gsub(':', '-') if mac
  append = @host.facts['append']
-%>
{
  "kernel": "<%= @kernel %>",
  "initram": "<%= @initrd %>",
<% if (@host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major.to_i > 16) or
    (@host.operatingsystem.name != 'Fedora' and @host.operatingsystem.major.to_i >= 7) -%>
  "append": "ks=<%= foreman_url('provision') %> inst.ks.sendmac <%= "ksdevice=bootif BOOTIF=#{bootif} #{append}" %>"
<% else -%>
  "append": "ks=<%= foreman_url('provision') %> kssendmac <%= "BOOTIF=#{bootif} #{append}" %>"
<% end -%>
}

The template was designed for DHCP-less environments and it assumes static IP configuration. These "discovery_*" facts are not present, therefore the default template generates "ip=::::::none" Anaconda configuration which leads to System halted. The modified version does not provide static configuration, therefore Anaconda performs DHCP request.

Make sure to set this template as default one for required Operating Systems.

Step 4: Verify requirements and provision

Before provisioning the very first discovered node, show the detail page, expand all facts and search for "discovery_kexec" fact, it should be set to "1". Also make sure the Red Hat KExec template is associated with Operating System.

Discovered hosts now can be provisioned or auto-provisioned and kexec will be performed instead of reboot.

Troubleshooting

On some hardware or VMs, kexec will freeze when discovered node is on the first virtual console (tty1) with the text user interface.

To workaround this issue switch virtual terminal to tty2 (Alt+F2) before kexecing.


关于作者

Lukáš Zapletal is a principal software engineer at Red Hat,  and is involved in the Foreman and Fedora communities as well as working on Red Hat Satellite 6. He is also interested in security, SELinux, and performance monitoring with Performance Co-Pilot (PCP).

UI_Icon-Red_Hat-Close-A-Black-RGB

按频道浏览

automation icon

自动化

有关技术、团队和环境 IT 自动化的最新信息

AI icon

人工智能

平台更新使客户可以在任何地方运行人工智能工作负载

open hybrid cloud icon

开放混合云

了解我们如何利用混合云构建更灵活的未来

security icon

安全防护

有关我们如何跨环境和技术减少风险的最新信息

edge icon

边缘计算

简化边缘运维的平台更新

Infrastructure icon

基础架构

全球领先企业 Linux 平台的最新动态

application development icon

应用领域

我们针对最严峻的应用挑战的解决方案

Virtualization icon

虚拟化

适用于您的本地或跨云工作负载的企业虚拟化的未来