Skip to content

Commit 62a14aa

Browse files
sbernhardm-bucher
authored andcommitted
Add iPXE Template
1 parent 074644d commit 62a14aa

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-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: Agama 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

test/unit/foreman/renderer/snapshots.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ files:
7272
- PXELinux/preseed_default_pxelinux_autoinstall.erb
7373
- PXEGrub2/preseed_default_pxegrub2_autoinstall.erb
7474
- user_data/preseed_autoinstall_cloud_init.erb
75+
- iPXE/agama_default_ipxe.erb
7576
- iPXE/autoyast_default_ipxe.erb
7677
- iPXE/ipxe_default_local_boot.erb
7778
- iPXE/ipxe_global_default.erb
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!gpxe
2+
echo Trying to ping Gateway: ${netX/gateway}
3+
ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
4+
echo Trying to ping DNS: ${netX/dns}
5+
ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.
6+
7+
8+
kernel http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz initrd=initrd.img splash=silent useDHCP=1 showopts root=live:url --url http://mirror.centos.org/centos/7/os/x86_64/LiveOS/squashfs.img inst.install_url=url --url http://mirror.centos.org/centos/7/os/x86_64/install/ inst.auto=http://foreman.example.com/unattended/provision
9+
initrd http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
10+
boot

0 commit comments

Comments
 (0)