Foreman discovery image - kexec from iso

Problem:

fdi always trying to download kernel & initrd via wget from foreman_url

Expected outcome:

Possibility to kexec from kernel/initrd included in foreman discovery image.

Foreman and Proxy versions:

foreman-2.1.4-1.el7.noarch

Foreman and Proxy plugin versions:

tfm-rubygem-foreman_discovery-16.1.2-1.fm2_1.el7.noarch

Distribution and version:

Red Hat Enterprise Linux Server release 7.8 (Maipo)

Hey guys!

I included the centOS kickstart-repositories into the foreman discovery image, to install clients which suffer from a slow network connection.

In order to accelerate the installation process further, I would like to kexec from the kickstart-repositories that Ive included in the foreman discovery image.

Unfortunately foreman always send a command to download vmlinuz/initrd via wget before running kexec.

Is there any way to modify this behaviour?

Feb 25 10:31:46 fdi foreman-proxy[1471]: Rack::Handler::WEBrick is invoked.
Feb 25 10:31:46 fdi foreman-proxy[1471]: Started PUT /power/kexec
Feb 25 10:31:46 fdi foreman-proxy[1471]: Initiated kexec provisioning with {"kernel":"/run/initramfs/live/isolinux/vmlinuz0","initram":"/run/initramfs/live/isolinux/initrd0.img","append":"ks=http://foreman.
Feb 25 10:31:46 fdi foreman-proxy[1471]: Downloading: /run/initramfs/live/isolinux/vmlinuz0
Feb 25 10:31:46 fdi foreman-proxy[1471]: Starting task: /usr/bin/wget --connect-timeout=10 --dns-timeout=10 --read-timeout=60 --tries=3 --no-check-certificate -nv -c "/run/initramfs/live/isolinux/vmlinuz0" -O "/t
Feb 25 10:31:46 fdi foreman-proxy[1471]: Finished PUT /power/kexec with 200 (5.75 ms)
Feb 25 10:31:46 fdi foreman-proxy[1471]: [1744] /run/initramfs/live/isolinux/vmlinuz0: Scheme missing.
Feb 25 10:31:46 fdi foreman-proxy[1471]: cannot download vmlinuz for kexec
Feb 25 10:31:47 fdi smart-proxy[1471]: 10.10.10.10 - - [25/Feb/2021:10:31:46 UTC] "PUT /power/kexec HTTP/1.1" 200 15
Feb 25 10:31:47 fdi smart-proxy[1471]: - -> /power/kexec
Feb 25 10:31:47 fdi foreman-proxy[1471]: close: 10.10.10.10:51110

thank you very much and kind regards!

Hello, sorry I don’t understand what are you trying to achieve.

Hey @lzap,

sorry I’ll try to explain it again.

We use the foreman discovery image to provision hosts in different remote locations. Unfortunately some remote locations suffer under a slow network connection.

To speed up the installation process Ive included the installation repositories (centOS8 kickstart) into the foreman discovery image and remastered the image. Then I changed the provisioning template for these hosts to use the kickstart-repository included in the new image.

ks.cfg

...
url --url=file:///run/install/repo/BaseOS/
repo --name Minimal --baseurl file:///run/install/repo/Minimal/
...

This works as expected, the hosts are using the repositories included in the iso for the os-installation.

The only thing that still slows down the installation is that kernel & initrd which are loaded via kexec are still loaded via network.

I changed the related provisioning template ‘discovery redhat kexec’ in the following way but the foreman-proxy service included in the foreman discovery image always using wget before using kexec to load kernel/initrd. Is there any way to change this?

Discovery Red Hat kexec
<%#
kind: kexec
name: Discovery Red Hat kexec
...
  "kernel": "/run/initramfs/live/isolinux/vmlinuz0",
  "initram": "/run/initramfs/live/isolinux/initrd0.img",
...

Okay, this is wild.

This was not designed for this workflow, wget is hardcoded and I would like not to change this - it’s painful code, it’s actually a plugin (RPM) for the smart proxy and building and testing this is a huge pain. One day, I will replace discovery with just a dracut image - that one will be a breeze to customize and with a SSH server onboard this will be easily doable.

However, if you intend to install Red Hat systems only, I suggest you to point your attention to a different workflow. Starting from RHEL 7.5 (I think) Anaconda searches for /ks.cfg file on all mounted devices. You can actually download kickstart for your host, make an ISO file and attach it. Then just boot the official DVD (either full DVD or netboot DVD) and it will work.

I actually prototyped a small script which downloads the kickstart and creates such an image:

It’s not exactly the same workflow but it’s quite close (all RPMs are on the DVD).

Warning: This is untested, just a rough prototype. But if this works for you, send a PR and let’s improve it!