Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions app/views/unattended/partition_tables_templates/agama_default.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<%#
kind: ptable
name: Agama default
model: Ptable
oses:
- OpenSUSE
- SLES
%>
<%
pxe_loader = @host.pxe_loader || ''
-%>

"drives": [
{
"search": "*",
"partitions": [
{
"search": "*",
"delete": true
},
{
"filesystem": { "path": "/boot", "type": "ext3", "name": "boot" },
"size": { "min": "2 GiB", "max": "4 GiB" }
},
<%- if pxe_loader.include?('UEFI') -%>
{
"filesystem": { "path": "/boot/efi", "type": "vfat", "name": "vfat" },
"size": "1 GiB"
},
<%- end -%>
{
"generate": "default"
}
]
}
],
"boot": {
"configure": false
}
61 changes: 61 additions & 0 deletions app/views/unattended/partition_tables_templates/agama_lvm.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<%#
kind: ptable
name: Agama LVM
model: Ptable
oses:
- OpenSUSE
- SLES
%>
<%
pxe_loader = @host.pxe_loader || ''
-%>

"boot": { "configure": false },
"drives": [
{
"alias": "disk",
"search": "*",
"partitions": [
{
"search": "*",
"delete": true
},
<%- if pxe_loader.include?('UEFI') -%>
{
"filesystem": { "path": "/boot/efi", "type": "vfat" },
"size": "1 GiB"
},
<%- else -%>
{
"filesystem": { "path": "/boot/", "type": "ext3" },
"size": "2 GiB"
},
<%- end -%>
{
"alias": "pv",
"id": "lvm",
"size": { "min": "20 GiB" }
}
]
}
],
"volumeGroups": [
{
"name": "system",
"physicalVolumes": [ "pv" ],
"logicalVolumes": [
{
"filesystem": { "path": "/", "type": "ext3", "name": "root" },
"size": { "min": "10 GiB" }
},
{
"filesystem": { "path": "/var", "type": "ext3", "name": "var" },
"size": { "min": "2 GiB", "max": "10 GiB" }
},
{
"filesystem": { "path": "swap", "type": "swap", "name": "swap" },
"size": { "min": "1 GiB", "max": "8 GiB" }
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<%#
kind: PXEGrub2
name: Agama default PXEGrub2
model: ProvisioningTemplate
oses:
- OpenSUSE
- SLES
description: |
The template to render PXEGrub2 bootloader configuration for Agama based distributions.
The output is deployed on the host's subnet TFTP proxy.
-%>
# This file was deployed via '<%= template_name %>' template
<%
if [email protected]_loader_efi?
linuxcmd = "linux"
initrdcmd = "initrd"
else
linuxcmd = "linuxefi"
initrdcmd = "initrdefi"
end

if host_param('http-proxy')
if host_param('http-proxy-port')
http_proxy_string = "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
else
http_proxy_string = "proxy=http://" + host_param('http-proxy')
end
else
http_proxy_string = ''
end

kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')} #{http_proxy_string}"
-%>

set default=<%= host_param('default_grub_install_entry') || 0 %>
set timeout=<%= host_param('loader_timeout') || 10 %>

menuentry '<%= template_name %>' {
<%= linuxcmd %> <%= @kernel %> <%= kernel_options %>
<%= initrdcmd %> <%= @initrd %>
}

<%
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1811561 and https://bugzilla.redhat.com/show_bug.cgi?id=1842893
subnet = @host.provision_interface.subnet || @host.provision_interface.subnet6
if subnet && subnet.httpboot
proxy_http_port = subnet.httpboot.httpboot_http_port
proxy_https_port = subnet.httpboot.httpboot_https_port
# Workaround for "no DNS server configured" https://bugzilla.redhat.com/show_bug.cgi?id=1842509
proxy_host = dns_lookup(subnet.httpboot.hostname)
-%>
<% if proxy_http_port -%>
menuentry '<%= template_name %> EFI HTTP' --id efi_http {
<%= linuxcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @kernel %> <%= kernel_options %>
<%= initrdcmd %> (http,<%= proxy_host %>:<%= proxy_http_port %>)/httpboot/<%= @initrd %>
}
<% else -%>
# Smart proxy does not have HTTPBoot feature with HTTP port enabled, skipping EFI HTTP boot menu entry
<% end -%>

<% if proxy_https_port -%>
menuentry '<%= template_name %> EFI HTTPS' --id efi_https {
<%= linuxcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @kernel %> <%= kernel_options %>
<%= initrdcmd %> (https,<%= proxy_host %>:<%= proxy_https_port %>)/httpboot/<%= @initrd %>
}
<% else -%>
# Smart proxy does not have HTTPBoot feature with HTTPS port enabled, skipping EFI HTTPS boot menu entry
<% end -%>

<% end %>

<%= snippet_if_exists(template_name + " custom menu") %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<%#
kind: PXELinux
name: Agama default PXELinux
model: ProvisioningTemplate
oses:
- OpenSUSE
- SLES
description: |
The template to render PXELinux bootloader configuration for SLES and OpenSUSE distributions.
The output is deployed on the host's subnet TFTP proxy.
-%>
<%
extra_args = []
if host_param('http-proxy') && host_param('http-proxy-port')
extra_args << "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
elsif host_param('http-proxy')
extra_args << "proxy=http://" + host_param('http-proxy')
end
subnet = @host.subnet
unless subnet.respond_to?(:dhcp_boot_mode?) and subnet.dhcp_boot_mode?
extra_args << "useDHCP=0"
extra_args << "netsetup=-dhcp"
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}"
end

kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')}"
-%>
DEFAULT linux

LABEL linux
KERNEL <%= @kernel %>
APPEND initrd=<%= @initrd %> <%= kernel_options %> <%= extra_args.join(' ') %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<%#
kind: finish
name: Agama default finish
model: ProvisioningTemplate
oses:
- OpenSUSE
- SLES
-%>
<%
pm_set = @host.puppet_server.present?
puppet_enabled = pm_set || host_param_true?('force-puppet')
salt_enabled = host_param('salt_master').present?
-%>

/usr/bin/hostnamectl set-hostname <%= @host.name %>

<%= snippet_if_exists(template_name + " custom pre") -%>

<%- if plugin_present?('katello') && host_param('kt_activation_keys') -%>
<%= snippet_if_exists("sles_register") -%>
<% end -%>

<%= snippet('remote_execution_ssh_keys') -%>

<% if plugin_present?('katello') && host_param_true?('enable-remote-execution-pull') -%>
<%= save_to_file('/root/remote_execution_pull_setup.sh', snippet('remote_execution_pull_setup'), verbatim: true) %>
chmod +x /root/remote_execution_pull_setup.sh
/root/remote_execution_pull_setup.sh
<% end -%>

<%= snippet "blacklist_kernel_modules" -%>

<% if puppet_enabled -%>
<%= snippet 'puppet_setup' -%>
<% end -%>

<% if salt_enabled -%>
<%= snippet 'saltstack_setup' -%>
<% end -%>

<%= snippet 'eject_cdrom' -%>

<%= snippet_if_exists(template_name + " custom post") -%>

# Mark the build as finished
<%= snippet 'built' -%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!gpxe
<%#
kind: iPXE
name: Agama default iPXE
model: ProvisioningTemplate
oses:
- SLES
- OpenSUSE
description: |
The template to render iPXE installation script for SLES and OpenSUSE
The output is deployed on the host's subnet TFTP proxy.
See https://ipxe.org/scripting for more details
-%>
<%
extra_args = []
if host_param('http-proxy') && host_param('http-proxy-port')
extra_args << "proxy=http://" + host_param('http-proxy') + ":" + host_param('http-proxy-port')
elsif host_param('http-proxy')
extra_args << "proxy=http://" + host_param('http-proxy')
end

kernel_options = "showopts root=live:#{@mediapath}/LiveOS/squashfs.img inst.install_url=#{@mediapath}/install/ inst.auto=#{foreman_url('provision')} #{extra_args.join(' ')}"
-%>
echo Trying to ping Gateway: ${netX/gateway}
ping --count 1 ${netX/gateway} || echo Ping to Gateway failed or ping command not available.
echo Trying to ping DNS: ${netX/dns}
ping --count 1 ${netX/dns} || echo Ping to DNS failed or ping command not available.

<% boot_files_uris = @host.operatingsystem.boot_files_uri(medium_provider) -%>
<% kernel = boot_files_uris[0] -%>
<% initrd = boot_files_uris[1] -%>

<% subnet = @host.subnet -%>
<% if subnet.respond_to?(:dhcp_boot_mode?) && subnet.dhcp_boot_mode? -%>
kernel <%= kernel %> initrd=initrd.img splash=silent useDHCP=1 <%= kernel_options %>
<% else -%>
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 %>
<% end -%>
initrd <%= initrd %>
boot
Loading