Sha256: e927b4ac9c620e93dd4b741837d1b9e55ea9cb02ee6319f450d2b9893a147e27
Contents?: true
Size: 1.72 KB
Versions: 5
Compression:
Stored size: 1.72 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. <% interface = @host.provision_interface bootdisk_raise(N_('Host has no provisioning interface defined')) unless interface bootdisk_raise(N_('Host has no IP address defined')) if interface.ip.nil? || interface.ip.empty? bootdisk_raise(N_('Host has no subnet defined')) unless interface.subnet bootdisk_raise(N_('Host has no domain defined')) unless interface.domain bootdisk_raise(N_('Subnet (%s) has no gateway defined'), interface.subnet) if interface.subnet.gateway.nil? || interface.subnet.gateway.empty? bootdisk_raise(N_('Subnet (%s) has no primary DNS server defined'), interface.subnet) if interface.subnet.dns_primary.nil? || interface.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} <%= interface.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 <%= interface.ip %> set netX/netmask <%= interface.subnet.mask %> set netX/gateway <%= interface.subnet.gateway %> route # Note, iPXE can only use one DNS server set dns <%= interface.subnet.dns_primary %> set domain <%= interface.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 <%= interface.mac %> sleep 30 exit 1
Version data entries
5 entries across 5 versions & 1 rubygems