Skip to content

Commit 50ebfd8

Browse files
committed
Fixes #38877 - Add Agama installer templates (SLES16)
1 parent 8030e46 commit 50ebfd8

File tree

15 files changed

+883
-0
lines changed

15 files changed

+883
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<%#
2+
kind: ptable
3+
name: Agama default
4+
model: Ptable
5+
oses:
6+
- OpenSUSE
7+
- SLES
8+
%>
9+
<%
10+
pxe_loader = @host.pxe_loader || ''
11+
-%>
12+
13+
"drives": [
14+
{
15+
"search": "*",
16+
"partitions": [
17+
{
18+
"search": "*",
19+
"delete": true
20+
},
21+
{
22+
"filesystem": { "path": "/boot", "type": "ext3", "name": "boot" },
23+
"size": { "min": "2 GiB", "max": "4 GiB" }
24+
},
25+
<%- if pxe_loader.include?('UEFI') -%>
26+
{
27+
"filesystem": { "path": "/boot/efi", "type": "vfat", "name": "vfat" },
28+
"size": "1 GiB"
29+
},
30+
<%- end -%>
31+
{
32+
"generate": "default"
33+
}
34+
]
35+
}
36+
],
37+
"boot": {
38+
"configure": false
39+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<%#
2+
kind: ptable
3+
name: Agama LVM
4+
model: Ptable
5+
oses:
6+
- OpenSUSE
7+
- SLES
8+
%>
9+
<%
10+
pxe_loader = @host.pxe_loader || ''
11+
-%>
12+
13+
"boot": { "configure": false },
14+
"drives": [
15+
{
16+
"alias": "disk",
17+
"search": "*",
18+
"partitions": [
19+
{
20+
"search": "*",
21+
"delete": true
22+
},
23+
<%- if pxe_loader.include?('UEFI') -%>
24+
{
25+
"filesystem": { "path": "/boot/efi", "type": "vfat" },
26+
"size": "1 GiB"
27+
},
28+
<%- else -%>
29+
{
30+
"filesystem": { "path": "/boot/", "type": "ext3" },
31+
"size": "2 GiB"
32+
},
33+
<%- end -%>
34+
{
35+
"alias": "pv",
36+
"id": "lvm",
37+
"size": { "min": "20 GiB" }
38+
}
39+
]
40+
}
41+
],
42+
"volumeGroups": [
43+
{
44+
"name": "system",
45+
"physicalVolumes": [ "pv" ],
46+
"logicalVolumes": [
47+
{
48+
"filesystem": { "path": "/", "type": "ext3", "name": "root" },
49+
"size": { "min": "10 GiB" }
50+
},
51+
{
52+
"filesystem": { "path": "/var", "type": "ext3", "name": "var" },
53+
"size": { "min": "2 GiB", "max": "10 GiB" }
54+
},
55+
{
56+
"filesystem": { "path": "swap", "type": "swap", "name": "swap" },
57+
"size": { "min": "1 GiB", "max": "8 GiB" }
58+
}
59+
]
60+
}
61+
]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<%#
2+
kind: PXEGrub2
3+
name: Agama default PXEGrub2
4+
model: ProvisioningTemplate
5+
oses:
6+
- OpenSUSE
7+
- SLES
8+
description: |
9+
The template to render PXEGrub2 bootloader configuration for Agama based distributions.
10+
The output is deployed on the host's subnet TFTP proxy.
11+
-%>
12+
# This file was deployed via '<%= template_name %>' template
13+
<%
14+
if [email protected]_loader_efi?
15+
linuxcmd = "linux"
16+
initrdcmd = "initrd"
17+
else
18+
linuxcmd = "linuxefi"
19+
initrdcmd = "initrdefi"
20+
end
21+
22+
if host_param('http-proxy')
23+
if host_param('http-proxy-port')
24+
http_proxy_string = "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
25+
else
26+
http_proxy_string = "proxy=http://" + host_param('http-proxy')
27+
end
28+
else
29+
http_proxy_string = ''
30+
end
31+
32+
kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')} #{http_proxy_string}"
33+
-%>
34+
35+
set default=<%= host_param('default_grub_install_entry') || 0 %>
36+
set timeout=<%= host_param('loader_timeout') || 10 %>
37+
38+
menuentry '<%= template_name %>' {
39+
<%= linuxcmd %> <%= @kernel %> <%= kernel_options %>
40+
<%= initrdcmd %> <%= @initrd %>
41+
}
42+
43+
<%
44+
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1811561 and https://bugzilla.redhat.com/show_bug.cgi?id=1842893
45+
subnet = @host.provision_interface.subnet || @host.provision_interface.subnet6
46+
if subnet && subnet.httpboot
47+
proxy_http_port = subnet.httpboot.httpboot_http_port
48+
proxy_https_port = subnet.httpboot.httpboot_https_port
49+
# Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509
50+
proxy_host = dns_lookup(subnet.httpboot.hostname)
51+
-%>
52+
<% if proxy_http_port -%>
53+
menuentry '<%= template_name %> EFI HTTP' --id efi_http {
54+
<%= linuxcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @kernel %> <%= kernel_options %>
55+
<%= initrdcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @initrd %>
56+
}
57+
<% else -%>
58+
# Smart proxy does not have HTTPBoot feature with HTTP port enabled, skipping EFI HTTP boot menu entry
59+
<% end -%>
60+
61+
<% if proxy_https_port -%>
62+
menuentry '<%= template_name %> EFI HTTPS' --id efi_https {
63+
<%= linuxcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @kernel %> <%= kernel_options %>
64+
<%= initrdcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @initrd %>
65+
}
66+
<% else -%>
67+
# Smart proxy does not have HTTPBoot feature with HTTPS port enabled, skipping EFI HTTPS boot menu entry
68+
<% end -%>
69+
70+
<% end %>
71+
72+
<%= snippet_if_exists(template_name + " custom menu") %>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<%#
2+
kind: PXELinux
3+
name: Agama default PXELinux
4+
model: ProvisioningTemplate
5+
oses:
6+
- OpenSUSE
7+
- SLES
8+
description: |
9+
The template to render PXELinux bootloader configuration for SLES and OpenSUSE distributions.
10+
The output is deployed on the host's subnet TFTP proxy.
11+
-%>
12+
<%
13+
extra_args = []
14+
if host_param('http-proxy') && host_param('http-proxy-port')
15+
extra_args << "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
16+
elsif host_param('http-proxy')
17+
extra_args << "proxy=http://" + host_param('http-proxy')
18+
end
19+
subnet = @host.subnet
20+
unless subnet.respond_to?(:dhcp_boot_mode?) and subnet.dhcp_boot_mode?
21+
extra_args << "useDHCP=0"
22+
extra_args << "netsetup=-dhcp"
23+
extra_args << "ifcfg=*=#{@host.primary_interface.ip}/#{@host.primary_interface.subnet.cidr},#{@host.primary_interface.subnet.gateway},#{@host.primary_interface.subnet.dns_primary},#{@host.domain}"
24+
end
25+
26+
kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')}"
27+
-%>
28+
DEFAULT linux
29+
30+
LABEL linux
31+
KERNEL <%= @kernel %>
32+
APPEND initrd=<%= @initrd %> <%= kernel_options %> <%= extra_args.join(' ') %>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<%#
2+
kind: finish
3+
name: Agama default finish
4+
model: ProvisioningTemplate
5+
oses:
6+
- OpenSUSE
7+
- SLES
8+
-%>
9+
<%
10+
pm_set = @host.puppet_server.present?
11+
puppet_enabled = pm_set || host_param_true?('force-puppet')
12+
salt_enabled = host_param('salt_master').present?
13+
-%>
14+
15+
/usr/bin/hostnamectl set-hostname <%= @host.name %>
16+
17+
<%= snippet_if_exists(template_name + " custom pre") -%>
18+
19+
<%- if plugin_present?('katello') && host_param('kt_activation_keys') -%>
20+
<%= snippet_if_exists("sles_register") -%>
21+
<% end -%>
22+
23+
<%= snippet('remote_execution_ssh_keys') -%>
24+
25+
<% if plugin_present?('katello') && host_param_true?('enable-remote-execution-pull') -%>
26+
<%= save_to_file('/root/remote_execution_pull_setup.sh', snippet('remote_execution_pull_setup'), verbatim: true) %>
27+
chmod +x /root/remote_execution_pull_setup.sh
28+
/root/remote_execution_pull_setup.sh
29+
<% end -%>
30+
31+
<%= snippet "blacklist_kernel_modules" -%>
32+
33+
<% if puppet_enabled -%>
34+
<%= snippet 'puppet_setup' -%>
35+
<% end -%>
36+
37+
<% if salt_enabled -%>
38+
<%= snippet 'saltstack_setup' -%>
39+
<% end -%>
40+
41+
<%= snippet 'eject_cdrom' -%>
42+
43+
<%= snippet_if_exists(template_name + " custom post") -%>
44+
45+
# Mark the build as finished
46+
<%= snippet 'built' -%>
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

0 commit comments

Comments
 (0)