Preseed Script Template Variables #
SynergyCP preseed scripts use the Smarty template engine to dynamically generate automated installation configurations. This document provides a complete reference of all available template variables.
Overview #
Preseed scripts (for Debian/Ubuntu) and kickstart scripts (for CentOS/RHEL/AlmaLinux) are stored in SynergyCP under OS Reloads → Preseeds. These scripts provide automated answers to the OS installer and are fetched by the installer during the installation process via the {$preseed_url} variable from the boot script.
Please be cognizant that you’re only using preseed variables in preseed templates. Boot script variables will not work in preseed templates, although there’s a few variables that have name overlap.
Available Variables Summary #
| Variable | Type | Description |
|---|---|---|
{$hostname} |
string | Server hostname |
{$password} |
string | Encrypted root/administrator password |
{$ip} |
string | Primary IP address (deprecated, use {$server.primary_ip}) |
{$netmask} |
string | Subnet mask (deprecated, use {$server.primary_ip}) |
{$gateway} |
string | Gateway IP (deprecated, use {$server.primary_ip}) |
{$url.update} |
string | API endpoint to update installation status |
{$url.script.during} |
string | URL to during-install shell script |
{$url.script.final} |
string | URL to final shell script |
{$server.id} |
integer | Server ID |
{$server.mac} |
string | Primary port MAC address |
{$server.use_uefi} |
boolean | Whether server boots with UEFI |
{$server.primary_ip} |
array | Primary IP address details |
{$server.all_ips} |
array | All static IP addresses for OS reload |
{$install.id} |
integer | Installation ID |
{$install.disk.raid} |
integer/null | RAID level (0, 1, 10, or null) |
{$install.disk.index} |
integer | Disk index |
{$install.disk.linux} |
string | Linux disk identifier (e.g., sda) |
{$install.url} |
string | API endpoint for install details |
{$share.http} |
string | HTTP URL to file server |
{$share.host} |
string | File server hostname/IP |
{$share.dir} |
string | Directory path on share |
{$share.path} |
string | Full UNC path to share |
{$image} |
string | ISO image name (if applicable) |
{$product_key} |
string | Windows product key (Windows only) |
{$drivers} |
array | Windows drivers (Windows only) |
{$dns} |
array | DNS server addresses (Windows only) |
Available Variables #
Basic Configuration #
{$hostname}
#
Type: string
Example: server1.example.com or ABC123
Description: The hostname for the server. Uses the server’s nickname if set, otherwise falls back to the server ID.
Usage:
# Debian Installer (d-i)
d-i netcfg/hostname string {$hostname}
d-i netcfg/get_hostname string {$hostname}
# CentOS/RHEL/AlmaLinux Kickstart
network --hostname {$hostname}
# Ubuntu Subiquity (Autoinstall)
hostname: {$hostname}
{$password}
#
Type: string
Description: Encrypted password hash for the root user. For Linux systems, this is a crypt-style hash. For Windows systems, this is a Windows-compatible password hash.
Usage:
# Debian Installer (d-i)
d-i passwd/root-password-crypted password {$password}
# CentOS/RHEL/AlmaLinux Kickstart
rootpw --iscrypted {$password}
# Ubuntu Subiquity (Autoinstall)
- sed -i 's|^root:.:|root:{$password}:|' /target/etc/shadow
Network Configuration (Deprecated) #
These top-level variables are deprecated. Use {$server.primary_ip} instead for new scripts.
{$ip}
#
Type: string
Example: 192.168.1.100
Description: Primary IP address for the server.
Deprecated: This variable is deprecated. Use {$server.primary_ip.addresses[0]} instead.
Usage:
# CentOS/RHEL/AlmaLinux Kickstart
network --ip {$ip}
{$netmask}
#
Type: string
Example: 255.255.255.0
Description: Subnet mask for the primary IP.
Deprecated: This variable is deprecated. Use {$server.primary_ip} to calculate the netmask from the CIDR mask instead.
Usage:
# CentOS/RHEL/AlmaLinux Kickstart
network --netmask {$netmask}
{$gateway}
#
Type: string
Example: 192.168.1.1
Description: Gateway IP address for the primary IP.
Deprecated: This variable is deprecated. Use {$server.primary_ip.gateway} instead.
Usage:
# CentOS/RHEL/AlmaLinux Kickstart
network --gateway {$gateway}
Installation Scripts #
{$url.update}
#
Type: string
Example: https://synergycp.example.com/api/server/123/install/456?key=abc123
Description: API endpoint URL to update the installation status. Scripts can POST to this URL to notify SynergyCP of installation progress.
Usage:
# Shell script
curl -X POST "{$url.update}" -d "status=installing"
{$url.script.during}
#
Type: string
Example: https://synergycp.example.com/api/server/123/install/456/script/during?key=abc123
Description: URL to a shell script that runs during the installation process (before the OS is fully installed).
Usage:
# Debian Installer (d-i)
d-i partman/early_command string \
wget -O /tmp/scp-during-commands.sh "{$url.script.during|replace:'https://':'http://'}"; \
. /tmp/scp-during-commands.sh
# CentOS/RHEL/AlmaLinux Kickstart
%pre
curl "{$url.script.during}" | /bin/bash
%end
# Ubuntu Subiquity (Autoinstall)
early-commands:
- curl --insecure -L {$url.script.during} | /bin/bash
{$url.script.final}
#
Type: string
Example: https://synergycp.example.com/api/server/123/install/456/script/final?key=abc123
Description: URL to a shell script that runs at the end of the installation process (after the OS is installed but before reboot).
Usage:
# Debian Installer (d-i)
d-i preseed/late_command string \
in-target /bin/bash -c 'curl --insecure -L {$url.script.final} | /bin/bash'
# CentOS/RHEL/AlmaLinux Kickstart
%post
curl {$url.script.final} | /bin/bash
%end
# Ubuntu Subiquity (Autoinstall)
late-commands:
- curtin in-target --target /target -- curl --insecure -L {$url.script.final} | /bin/bash
Server Information #
{$server.id}
#
Type: integer
Example: 123
Description: The unique server ID in SynergyCP.
{$server.mac}
#
Type: string
Example: 00:11:22:33:44:55
Description: MAC address of the server’s primary network port.
Usage:
# CentOS/RHEL/AlmaLinux Kickstart
network --device {$server.mac}
# Ubuntu Autoinstall (cloud-config)
match:
macaddress: {$server.mac}
{$server.use_uefi}
#
Type: boolean
Values: true or false
Description: Indicates whether the server boots using UEFI mode.
{$server.primary_ip}
#
Type: array
Description: Array containing detailed information about the server’s primary IP address.
Properties:
cidr- Full CIDR notation (e.g.,192.168.1.100/24)cidr_mask- CIDR mask number (e.g.,24)gateway- Gateway IP addressaddresses- Array of usable IP addresses in the range
Usage:
# Ubuntu Autoinstall (cloud-config)
addresses: [{$ip}/{$server.primary_ip.cidr_mask}]
routes:
- to: default
via: {$server.primary_ip.gateway}
{$server.all_ips}
#
Type: array
Description: Array of all static IP addresses configured for OS reload. Each element has the same structure as {$server.primary_ip}.
Usage:
# Iterate through all IPs
{foreach $server.all_ips as $ip_info}
# IP: {$ip_info.addresses[0]}
# Gateway: {$ip_info.gateway}
# CIDR: {$ip_info.cidr}
{/foreach}
Installation Details #
{$install.id}
#
Type: integer
Example: 456
Description: The unique installation ID in SynergyCP.
{$install.disk.raid}
#
Type: integer or null
Example: 1 (for RAID 1) or null (for no RAID)
Values: 0, 1, 10, or null
Description: The RAID level configured for this installation. null means no RAID.
Usage:
# AlmaLinux/CentOS Kickstart
{if $install.disk.raid === null}
# No RAID configuration
clearpart --all --drives={$install.disk.linux}
part /boot --fstype ext2 --size=250 --ondisk={$install.disk.linux}
{else}
# RAID configuration
raid /boot --level={$install.disk.raid} raid.01 raid.03
{/if}
{$install.disk.index}
#
Type: integer
Example: 0
Description: The index of the disk to use for installation.
{$install.disk.linux}
#
Type: string
Example: sda
Description: The Linux disk identifier for the primary installation disk.
Usage:
# AlmaLinux/CentOS Kickstart
clearpart --all --drives={$install.disk.linux}
part /boot --ondisk={$install.disk.linux}
{$install.url}
#
Type: string
Example: https://synergycp.example.com/api/server/123/install/456?key=abc123
Description: API endpoint URL for retrieving detailed installation information.
File Share #
{$share.http}
#
Type: string
Example: http://192.168.1.10:4002
Description: HTTP URL to access the SynergyCP file server for the IP group. Port 4002 is the default HTTP port.
{$share.host}
#
Type: string
Example: 192.168.1.10
Description: Hostname or IP address of the SynergyCP file server for the IP group.
{$share.dir}
#
Type: string
Example: debian\bookworm
Description: Directory path on the share (backslash-separated, no leading/trailing slashes).
{$share.path}
#
Type: string
Example: \\192.168.1.10\debian\bookworm
Description: Full UNC path to the share in Windows format.
Optional Variables #
{$image}
#
Type: string
Example: ubuntu-20.04-live-server-amd64.iso
Description: The name of the ISO image being used for installation. Only available if an edition with an image is selected.
Windows-Only Variables #
These variables are only available when installing Windows ($install->is_windows is true).
{$product_key}
#
Type: string
Example: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Description: Windows product key for activation.
Usage:
<ProductKey>{$product_key}</ProductKey>
{$drivers}
#
Type: array
Description: Collection of Windows driver shares. Each driver has a share.url property containing the UNC path.
Usage:
{foreach $drivers as $driver}
<PathAndCredentials wcm:action="add">
<Path>{$driver.share.url}</Path>
</PathAndCredentials>
{/foreach}
{$dns}
#
Type: array
Example: ['8.8.8.8', '8.8.4.4']
Description: Array of DNS server IP addresses for Windows installations. Defaults to Google DNS.
Usage:
<DNSServerSearchOrder>
{foreach $dns as $dns_server}
<IpAddress wcm:action="add" wcm:keyValue="{$dns_server@iteration}">{$dns_server}</IpAddress>
{/foreach}
</DNSServerSearchOrder>
Common Patterns #
HTTPS to HTTP Conversion #
Some installers don’t support HTTPS. Use the replace filter:
wget -O /tmp/script.sh "{$url.script.during|replace:'https://':'http://'}"
Disk Partitioning with RAID Detection #
{if $install.disk.raid === null}
# Single disk setup
clearpart --all --drives={$install.disk.linux}
part /boot --fstype ext2 --size=250 --ondisk={$install.disk.linux}
part pv.01 --size=1 --grow --ondisk={$install.disk.linux}
{else}
# RAID setup
clearpart --all --initlabel
part raid.01 --fstype="raid" --ondisk=sda --size=500
part raid.02 --fstype="raid" --ondisk=sdb --size=500
raid /boot --level={$install.disk.raid} raid.01 raid.02
{/if}
Advanced Disk Partitioning (NVMe vs SATA, UEFI vs Legacy, RAID) #
This example shows how to handle different disk types, boot modes, and RAID configurations dynamically in a kickstart script.
%pre
curl "{$url.script.during}" | /bin/bash
# Detect disk type and configure partitioning
if [ -e /dev/nvme0n1 ]; then
# NVMe drives detected
{if $install.disk.raid === null}
# Single NVMe disk
{if $server.use_uefi}
# UEFI boot with NVMe
echo "bootloader --location=boot --boot-drive=nvme0n1" > /tmp/part-include
echo "clearpart --all --initlabel --drives=nvme0n1" >> /tmp/part-include
echo "part /boot/efi --fstype=efi --size=600 --ondisk=nvme0n1" >> /tmp/part-include
echo "part /boot --fstype=xfs --size=1024 --ondisk=nvme0n1" >> /tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=nvme0n1" >> /tmp/part-include
{else}
# Legacy boot with NVMe
echo "bootloader --location=boot --boot-drive=nvme0n1" > /tmp/part-include
echo "clearpart --all --initlabel --drives=nvme0n1" >> /tmp/part-include
echo "part /boot --fstype=xfs --size=1024 --ondisk=nvme0n1" >> /tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=nvme0n1" >> /tmp/part-include
{/if}
{else}
# RAID with NVMe drives
echo "bootloader --location=boot --boot-drive=nvme0n1" > /tmp/part-include
echo "clearpart --all --initlabel --drives=nvme0n1,nvme1n1" >> /tmp/part-include
echo "part raid.01 --fstype=raid --ondisk=nvme0n1 --size=500" >> /tmp/part-include
echo "part raid.02 --fstype=raid --grow --ondisk=nvme0n1 --size=1" >> /tmp/part-include
echo "part raid.03 --fstype=raid --ondisk=nvme1n1 --size=500" >> /tmp/part-include
echo "part raid.04 --fstype=raid --grow --ondisk=nvme1n1 --size=1" >> /tmp/part-include
echo "raid /boot --device=md0 --fstype=xfs --level={$install.disk.raid} raid.01 raid.03" >> /tmp/part-include
echo "raid pv.01 --device=md1 --level={$install.disk.raid} raid.02 raid.04" >> /tmp/part-include
{/if}
else
# SATA/SAS drives detected
{if $install.disk.raid === null}
# Single SATA disk
{if $server.use_uefi}
# UEFI boot with SATA
echo "bootloader --location=boot --boot-drive=sda" > /tmp/part-include
echo "clearpart --all --initlabel --drives=sda" >> /tmp/part-include
echo "part /boot/efi --fstype=efi --size=600 --ondisk=sda" >> /tmp/part-include
echo "part /boot --fstype=xfs --size=1024 --ondisk=sda" >> /tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=sda" >> /tmp/part-include
{else}
# Legacy boot with SATA
echo "bootloader --location=boot --boot-drive=sda" > /tmp/part-include
echo "clearpart --all --initlabel --drives=sda" >> /tmp/part-include
echo "part /boot --fstype=xfs --size=1024 --ondisk=sda" >> /tmp/part-include
echo "part pv.01 --size=1 --grow --ondisk=sda" >> /tmp/part-include
{/if}
{else}
# RAID with SATA drives
echo "bootloader --location=boot --boot-drive=sda" > /tmp/part-include
echo "clearpart --all --initlabel --drives=sda,sdb" >> /tmp/part-include
echo "part raid.01 --fstype=raid --ondisk=sda --size=500" >> /tmp/part-include
echo "part raid.02 --fstype=raid --grow --ondisk=sda --size=1" >> /tmp/part-include
echo "part raid.03 --fstype=raid --ondisk=sdb --size=500" >> /tmp/part-include
echo "part raid.04 --fstype=raid --grow --ondisk=sdb --size=1" >> /tmp/part-include
{if $server.use_uefi}
# UEFI RAID requires EFI partition on both disks
echo "part /boot/efi --fstype=efi --size=600 --ondisk=sda" >> /tmp/part-include
echo "part /boot/efi2 --fstype=efi --size=600 --ondisk=sdb" >> /tmp/part-include
{/if}
echo "raid /boot --device=md0 --fstype=xfs --level={$install.disk.raid} raid.01 raid.03" >> /tmp/part-include
echo "raid pv.01 --device=md1 --level={$install.disk.raid} raid.02 raid.04" >> /tmp/part-include
{/if}
fi
%end
# Include the dynamically generated partitioning
%include /tmp/part-include
# Volume Group configuration
volgroup vg_root pv.01
# Logical Volume configuration
logvol swap --vgname=vg_root --size=4096 --name=lv_swap
logvol / --vgname=vg_root --size=1 --grow --name=lv_root
Key Concepts:
- Disk Type Detection: The
%presection uses shell script to detect whether NVMe (/dev/nvme0n1) or SATA (/dev/sda) drives are present - Dynamic Partitioning: Partition commands are generated dynamically and written to
/tmp/part-include, then included with%include /tmp/part-include - UEFI Handling:
{$server.use_uefi}determines whether to create an EFI system partition (/boot/efi) - RAID Configuration:
{$install.disk.raid}determines single disk vs RAID setup - UEFI RAID: When using UEFI with RAID, EFI partitions must be created on both disks (cannot be RAIDed)
Network Configuration by Installer Type #
Debian Installer (d-i):
d-i netcfg/choose_interface select auto
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_ipaddress string {$ip}
d-i netcfg/get_netmask string {$netmask}
d-i netcfg/get_gateway string {$gateway}
d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/confirm_static boolean true
d-i netcfg/hostname string {$hostname}
d-i netcfg/get_hostname string {$hostname}
Subiquity Installer (Ubuntu 20+):
network:
version: 2
ethernets:
eth0:
addresses: [{$ip}/{$server.primary_ip.cidr_mask}]
routes:
- to: default
via: {$server.primary_ip.gateway}
match:
macaddress: {$server.mac}
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
Anaconda Installer (CentOS/RHEL/AlmaLinux):
network --onboot yes --device {$server.mac} --bootproto static --ip {$ip} --netmask {$netmask} --gateway {$gateway} --nameserver 8.8.8.8 --hostname {$hostname}
Running Installation Scripts #
Early/During Installation:
# Debian Installer (d-i)
d-i partman/early_command string \
wget -O /tmp/script.sh "{$url.script.during|replace:'https://':'http://'}"; \
. /tmp/script.sh
# CentOS/RHEL/AlmaLinux Kickstart
%pre
curl "{$url.script.during}" | /bin/bash
%end
# Ubuntu Subiquity (Autoinstall)
early-commands:
- curl --insecure -L {$url.script.during} | /bin/bash
Late/Final Installation:
# Debian Installer (d-i)
d-i preseed/late_command string \
in-target curl --insecure -L {$url.script.final} | /bin/bash
# CentOS/RHEL/AlmaLinux Kickstart
%post
curl {$url.script.final} | /bin/bash
%end
# Ubuntu Subiquity (Autoinstall)
late-commands:
- curtin in-target --target /target -- curl --insecure -L {$url.script.final} | /bin/bash
Troubleshooting #
Variable Not Rendering #
If a variable shows as literal text (e.g., {$hostname} instead of server1):
- Check that the variable name is spelled correctly
- Verify the variable exists in the Available Variables list above
- Ensure you’re not inside a
{literal}block - For Windows-only variables, verify the installation is for Windows
Script Execution Issues #
If installation scripts aren’t running:
- Verify the URL is accessible:
{$url.script.during}should return a valid shell script - Check for HTTPS issues - use
|replace:'https://':'http://'if needed - Add
--insecureflag to curl commands for self-signed certificates - Add
-Lflag to curl commands to follow HTTP/HTTPS redirects:curl -L {$url.script.final} - Verify the API key hasn’t expired (4-hour timeout)
RAID Configuration Not Working #
If RAID partitioning fails:
- Check
{$install.disk.raid}value - should be0,1,10, ornull - Use strict comparison:
{if $install.disk.raid === null}not{if !$install.disk.raid} - Ensure enough disks are available for the RAID level
- Verify disk identifiers (
{$install.disk.linux}) match your hardware