|
<%#
|
|
kind: snippet
|
|
name: preseed_kernel_options_autoinstall
|
|
model: ProvisioningTemplate
|
|
snippet: true
|
|
description: options for the kernel / preseed startup initialization
|
|
oses:
|
|
- ubuntu
|
|
test_on:
|
|
- ubuntu_autoinst4dhcp
|
|
-%>
|
|
<%
|
|
hostname = @host.name
|
|
domain = @host.domain
|
|
iface = @host.provision_interface
|
|
mac = @host.provision_interface.mac
|
|
subnet4 = iface.subnet
|
|
subnet6 = iface.subnet6
|
|
image_path = @preseed_path.sub(/\/?$/, '.iso')
|
|
userdata_option = "ds=nocloud-net;s=http://#{foreman_request_addr}/userdata/#{mac ? mac + '/' : ''}"
|
|
options = []
|
|
|
|
if host_param('blacklist')
|
|
options << host_param('blacklist').split(',').collect{|x| "#{x.strip}.blacklist=yes"}.join(' ')
|
|
end
|
|
if @host.provision_interface.vlanid.present?
|
|
options << "netcfg/use_vlan=true netcfg/vlan_id=#{@host.provision_interface.vlanid}"
|
|
end
|
|
if subnet4 && subnet4.dhcp_boot_mode?
|
|
options << 'ip=dhcp'
|
|
elsif subnet4 && !subnet4.dhcp_boot_mode?
|
|
options << "ip=#{iface.ip}::#{subnet4.gateway}:#{subnet4.mask}:#{hostname}:#{iface.identifier}:none:#{subnet4.dns_servers.join(':')}"
|
|
elsif subnet6 && subnet6.dhcp_boot_mode?
|
|
options << 'ip=dhcp'
|
|
elsif subnet6 && !subnet6.dhcp_boot_mode?
|
|
options << "ip=[#{iface.ip6}]::[#{subnet6.gateway}]:[#{subnet6.mask}]:#{hostname}:#{iface.identifier}:none:[#{subnet6.dns_servers.join(']:[')}]"
|
|
end
|
|
|
|
options << "BOOTIF=#{mac}" if mac
|
|
options << 'ramdisk_size=1500000'
|
|
options << 'fsck.mode=skip'
|
|
options << 'autoinstall'
|
|
options << "url=http://#{@preseed_server}#{image_path}"
|
|
options << 'cloud-config-url=/dev/null'
|
|
if @add_userdata_quotes
|
|
options << "\"#{userdata_option}\""
|
|
else
|
|
options << userdata_option
|
|
end
|
|
options << 'console-setup/ask_detect=false'
|
|
options << "locale=#{host_param('lang') || 'en_US'}"
|
|
options << 'localechooser/translation/warn-light=true'
|
|
options << 'localechooser/translation/warn-severe=true'
|
|
options << "hostname=#{hostname}"
|
|
options << "domain=#{domain}"
|
|
%>
|
|
<%# do not add newline after the next line %>
|
|
<%= options.join(' ') -%>
|