Sha256: 2177fb34c52e768693536c7723a2dedda13a772eb6f6add1d5976b6fc5250384

Contents?: true

Size: 1.41 KB

Versions: 15

Compression:

Stored size: 1.41 KB

Contents

#!ipxe
# Example foreman_bootdisk generic host template
#
# This template is generic, but it will chainload to Foreman so expects the
# host to be registered already.
#
# It loops through all interfaces using DHCP, requesting a template from
# Foreman in the hope that one of the MACs or IPs matches.
#
# Copy this template to customize it, the original is read-only.

echo Foreman Bootdisk: Generic image

# loop over net* until we can get a template
<% url = bootdisk_chain_url %>
<% (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}
dhcp net<%= i %> || goto net<%= i+1 %>
chain <%= url %>${net<%= i -%>/mac} || goto net<%= i+1 %>
exit 0
<% end -%>
echo Failed to chainload from any network interface, fallback to static.
ifstat

:no_nic
echo -n Enter interface name to boot from (e.g. net0):  && read interface
isset ${${interface}/mac} && goto get_static_ip
echo Interface ${interface} is not initialized, try again
goto no_nic

:get_static_ip
ifopen ${interface}
echo Please enter IP details for ${interface}
echo
echo -n IP address      :  && read ${interface}/ip
echo -n Subnet mask     :  && read ${interface}/netmask
echo -n Default gateway :  && read ${interface}/gateway
echo -n DNS server      :  && read dns
chain <%= url %>${${interface}/mac} || goto boot_failure
exit 0

:boot_failure
echo Cannot continue, spawning shell
shell

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_bootdisk-19.0.4 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-19.0.3 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-19.0.2 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-19.0.1 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-19.0.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-18.1.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-18.0.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-17.1.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-17.0.2 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-16.1.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-16.0.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-15.1.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-15.0.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-14.0.0 app/views/foreman_bootdisk/generic_host.erb
foreman_bootdisk-13.0.0 app/views/foreman_bootdisk/generic_host.erb