Skip to content

Commit 13d08d0

Browse files
committed
Add iPXE Template
1 parent 074644d commit 13d08d0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!gpxe
2+
<%#
3+
kind: iPXE
4+
name: AutoYaST default iPXE
5+
model: ProvisioningTemplate
6+
oses:
7+
- SLES
8+
- OpenSUSE
9+
description: |
10+
The template to render iPXE installation script for SLES and OpenSUSE
11+
The output is deployed on the host's subnet TFTP proxy.
12+
See https://ipxe.org/scripting for more details
13+
-%>
14+
<%
15+
extra_args = []
16+
if host_param('http-proxy') && host_param('http-proxy-port')
17+
extra_args << "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
18+
elsif host_param('http-proxy')
19+
extra_args << "proxy=http://" + host_param('http-proxy')
20+
end
21+
22+
kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')} #{extra_args.join(' ')}"
23+
-%>
24+
echo Trying to ping Gateway: ${netX/gateway}
25+
ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
26+
echo Trying to ping DNS: ${netX/dns}
27+
ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.
28+
29+
<% boot_files_uris = @host.operatingsystem.boot_files_uri(medium_provider) -%>
30+
<% kernel = boot_files_uris[0] -%>
31+
<% initrd = boot_files_uris[1] -%>
32+
33+
<% subnet = @host.subnet -%>
34+
<% if subnet.respond_to?(:dhcp_boot_mode?) && subnet.dhcp_boot_mode? -%>
35+
kernel <%= kernel %> initrd=initrd.img splash=silent useDHCP=1 <%= kernel_options %>
36+
<% else -%>
37+
kernel <%= kernel %> initrd=initrd.img splash=silent useDHCP=0 netsetup=-dhcp ifcfg=*="${netX/ip}/<%= @host.primary_interface.subnet.cidr -%>,${netX/gateway},${dns},<%= @host.domain %>" <%= kernel_options %>
38+
<% end -%>
39+
initrd <%= initrd %>
40+
boot

0 commit comments

Comments
 (0)