Sha256: f9576b097e3d7abe9fcd78b034838d507df129d64a84f6d0acf76dd0dc561169

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

#!ipxe
# Example foreman_bootdisk host template
# This template is rendered for use inside a host-specific boot disk.
#
# Copy this template to customize it, the original is read-only.

<%
bootdisk_raise(N_('Host has no IP address defined')) if @host.ip.nil? || @host.ip.empty?
bootdisk_raise(N_('Host has no subnet defined')) unless @host.subnet
bootdisk_raise(N_('Host has no domain defined')) unless @host.domain
bootdisk_raise(N_('Subnet (%s) has no gateway defined'), @host.subnet) if @host.subnet.gateway.nil? || @host.subnet.gateway.empty?
bootdisk_raise(N_('Subnet (%s) has no primary DNS server defined'), @host.subnet) if @host.subnet.dns_primary.nil? || @host.subnet.dns_primary.empty?
%>

# loop over net* until the host's MAC matches
<% (0..32).each do |i| -%>
:net<%= i %>
isset ${net<%= i -%>/mac} || goto no_nic
echo net<%= i -%> is a ${net<%= i -%>/chip} with MAC ${net<%= i -%>/mac}
iseq ${net<%= i -%>/mac} <%= @host.mac -%> || goto net<%= i+1 %>
ifopen net<%= i %>
set idx:int32 <%= i %>
goto loop_success
<% end -%>

:loop_success
echo Configuring net${idx} for static IP address
ifopen net${idx}
set netX/ip <%= @host.ip %>
set netX/netmask <%= @host.subnet.mask %>
set netX/gateway <%= @host.subnet.gateway %>
route

# Note, iPXE can only use one DNS server
set dns <%= @host.subnet.dns_primary %>
set domain <%= @host.domain.to_s %>

# Chainload from Foreman rather than embedding OS info here, so the behaviour
# is entirely dynamic.
chain <%= bootdisk_chain_url %>
exit 0

:no_nic
echo Cannot find interface with MAC <%= @host.mac %>
sleep 30
exit 1

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_bootdisk-4.0.2 app/views/foreman_bootdisk/host.erb
foreman_bootdisk-4.0.1 app/views/foreman_bootdisk/host.erb
foreman_bootdisk-3.2.1 app/views/foreman_bootdisk/host.erb
foreman_bootdisk-4.0.0 app/views/foreman_bootdisk/host.erb
foreman_bootdisk-3.2.0 app/views/foreman_bootdisk/host.erb
foreman_bootdisk-3.1.2 app/views/foreman_bootdisk/host.erb