Boot Script Template Variables

Boot Script Template Variables #

SynergyCP boot scripts use the Smarty template engine to dynamically generate iPXE boot configurations. This document provides a complete reference of all available template variables.

Overview #

Boot scripts are stored in SynergyCP under OS Reloads → Boot Scripts and are used to build the kernel boot lines for PXE booting. They are rendered through the Smarty template engine when a server boots, with variables assigned and passed to the template for rendering.

Please be cognizant that you’re only using boot script variables in boot script templates. Preseed variables will not work in boot script templates, although there’s a few variables that have name overlap.

Available Variables Summary #

Variable Type Description
{$ip} string IP address to be assigned to the server
{$netmask} string Subnet mask for the server’s network
{$gateway} string Gateway IP address for the server’s network
{$mac} string MAC address of the server’s primary network port
{$preseed_url} string URL to preseed/kickstart configuration file
{$prescript_url} string URL to iPXE script that checks if OS is installed
{$password} string Root or administrator password
{$use_uefi} boolean Whether to boot using UEFI mode
{$share.http} string HTTP URL to deployment share (e.g., http://192.168.1.10:4002)
{$share.host} string Hostname or IP of deployment share server
{$share.dir} string Directory path on the share
{$share.path} string Full UNC path to the share

Available Variables #

Network Configuration #

These variables provide network configuration details for the server during installation.

{$ip} #

Type: string

Example: 192.168.1.100

Description: The IP address to be assigned to the server during installation.

Usage:

netcfg/get_ipaddress={$ip}

{$netmask} #

Type: string

Example: 255.255.255.0

Description: The subnet mask for the server’s network.

Usage:

netcfg/get_netmask={$netmask}

{$gateway} #

Type: string

Example: 192.168.1.1

Description: The gateway IP address for the server’s network.

Usage:

netcfg/get_gateway={$gateway}

{$mac} #

Type: string

Example: 00:11:22:33:44:55

Description: The MAC address of the server’s primary network port, formatted with colons.

Usage:

BOOTIF={$mac}
netcfg/choose_interface={$mac}
ksdevice={$mac}

Installation Configuration #

{$preseed_url} #

Type: string

Example: https://synergycp.example.com/api/server/123/install/456/preseed

Description: Full URL to the preseed (Debian/Ubuntu) or kickstart (CentOS/RHEL) configuration file. The OS installer fetches this URL to get automated installation answers.

Usage:

# Debian/Ubuntu
preseed/url={$preseed_url}
url={$preseed_url}

# CentOS/RHEL - often needs HTTPS converted to HTTP
ks={$preseed_url|replace:'https://':'http://'}

{$prescript_url} #

Type: string

Example: https://synergycp.example.com/api/server/123/install/456/script/is-installed?key=abc123

Description: URL to an iPXE script that checks if the OS is already installed. Returns a script that sets the ${is_installed} iPXE variable to 0 or 1.

Usage:

#!ipxe
chain --autofree {$prescript_url|replace:'https://':'http://'} || goto error

{literal}
iseq ${is_installed} 1 && goto boot_from_disk || goto boot_from_network
{/literal}

Script Output:

#!ipxe
set is_installed 1

Note: The ${is_installed} variable is an iPXE variable (not Smarty), which is why it uses ${...} syntax and appears within {literal} tags.


{$password} #

Type: string

Description: Root or administrator password for the installation. May be encrypted depending on the context.

Usage:

# System Rescue CD
rootpass={$password}

# In preseed files, typically crypted
d-i passwd/root-password-crypted password {$password}

{$use_uefi} #

Type: boolean

Values: true or false (or 1/0)

Description: Indicates whether the server is set to boot using UEFI mode instead of legacy BIOS mode. This is set in Edit mode of a server, then the PXE Boot Mode drop-down.

Usage:

{if $use_uefi}
initrd -n boot.wim {$share.http}/windows/WinPE.wim boot.wim
{else}
initrd {$share.http}/windows/WinPE.wim boot.wim
{/if}

Deployment Share #

The {$share} variable contains information about the SynergyCP file server configured for the server’s IP group. The template replacement uses the URL of the file server for the IP group, which hosts installation files like kernels, initrd images, and filesystem images.

{$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.

Example usage:

kernel {$share.http}/debian/bookworm/linux
initrd {$share.http}/debian/bookworm/initrd.gz

{$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.


Common Patterns #

Converting HTTPS to HTTP #

Older installers don’t support HTTPS for preseed/kickstart files. Use the replace filter:

url={$preseed_url|replace:'https://':'http://'}

Interface Selection #

Different distributions and installers handle network interface selection differently:

# Debian/Ubuntu (Debian Installer) - use BOOTIF and choose_interface
BOOTIF={$mac} netcfg/choose_interface={$mac}

# Ubuntu 20+ (Subiquity Installer) - autoinstall with cloud-init
autoinstall ds=nocloud-net;s={$preseed_url}

# CentOS/RHEL/AlmaLinux (Anaconda Installer) - use ksdevice
ksdevice={$mac}

Static Network Configuration #

Different installers require different parameters for static networking:

Debian Installer (Debian/Ubuntu):

netcfg/disable_dhcp=true
netcfg/get_ipaddress={$ip}
netcfg/get_netmask={$netmask}
netcfg/get_gateway={$gateway}
netcfg/confirm_static=true

Subiquity Installer (Ubuntu 20+):

# Network configuration is handled in the autoinstall cloud-init config
# fetched via the preseed_url, not in kernel parameters
autoinstall ds=nocloud-net;s={$preseed_url}

Anaconda Installer (CentOS/RHEL/AlmaLinux):

ip={$ip}
netmask={$netmask}
gateway={$gateway}
ksdevice={$mac}
dns=8.8.8.8

Troubleshooting #

Variable Not Rendering #

If a variable shows as literal text (e.g., {$ip} instead of 192.168.1.100):

  1. Check that the variable name is spelled correctly
  2. Verify the variable exists in the Available Variables list above
  3. Ensure you’re not inside a {literal} block

iPXE vs Smarty Variables #

Smarty variables (processed by SynergyCP):

  • Syntax: {$variable}
  • Example: {$ip}, {$mac}
  • Processed during template rendering

iPXE variables (processed by iPXE at boot time):

  • Syntax: ${variable}
  • Example: ${is_installed}, ${mac}
  • Must be inside {literal} blocks to prevent Smarty processing

HTTPS Issues #

If the installer fails to fetch the preseed URL:

# Change from:
preseed/url={$preseed_url}

# To:
preseed/url={$preseed_url|replace:'https://':'http://'}