Kickstart Static IP

The default provisioning templates that come with Foreman have support for setting a static IP.
Configuration differs on Foreman 1.8+ and pre 1.8.

Foreman 1.8+

The static or dhcp configuration is determined by Subnet to which interface is attached to.
If you do provisioning on Subnet with Boot mode set to static, provisioning template will
adjust configuration accordingly. Note that in most cases you must configure DNS server and
gateway on that subnet, because they won't be set by DHCP server. If you don't use DNS or
all your systems (e.g. installation medium) are on local subnet, you don't have to specify
these Subnet parameters.

pre Foreman 1.8

In order to enable static networking, you need to edit the PXE template and add &static=yes to the
end of each instance of foreman_url('provision'), like in this example below:

default linux
label linux
kernel <%= @kernel %>
<% if == 'Fedora' and @host.operatingsystem.major.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes ks.device=bootif network ks.sendmac
<% elsif != 'Fedora' and @host.operatingsystem.major.to_i >= 7 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes network ks.sendmac
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url('provision')%>&static=yes ksdevice=bootif network kssendmac
<% end -%>

There's an open feature request #5458 to make this more user friendly.

Updated by Marek Hulán about 9 years ago · 2 revisions