Template Variables (Macros)
Install scripts support several template variables that are dynamically replaced during processing:
$LOCATION(LocationId)
Resolves to user-configured or default paths for common directories.
Available Location IDs:
ApplicationsPerformance
- High-performance storage for app dataApplicationsCapacity
- High-capacity storage for app dataDownloads
- Download directoryDocuments
- Documents directoryMedia
- General media storagePhotos
- Photo storageMusic
- Music storageMovies
- Movie storageShows
- TV show storageVideos
- Video storageVirtualizationPerformance
- High-performance VM storageVirtualizationCapacity
- High-capacity VM storageInstallMedia
- Installation media storageVirtualDisks
- Virtual disk storage
Example:
"path": "$LOCATION(ApplicationsPerformance)/plex/data"
$RANDOM_STRING(length)
Generates a random alphanumeric string of specified length. Useful for passwords, keys, and database names.
Example:
"password": "$RANDOM_STRING(12)"
$MEMORY(percentage, minimum_mb)
Dynamically allocates memory based on system resources. Takes the higher value between the percentage of system memory and the minimum specified in MB.
Example:
"memory": "$MEMORY(10%, 2048)"
This allocates either 10% of system memory or 2048MB, whichever is higher
$HOST_PATH(path)
Creates a TrueNAS host path configuration object for predefined storage options.
Example:
"storage": {
"data": "$HOST_PATH($LOCATION(ApplicationsPerformance)/app/data)"
}
Expands to:
"storage": {
"data": {
"type": "host_path",
"host_path_config": {
"acl_enable": false,
"path": "/mnt/pool/apps/app/data"
}
}
}
$MOUNTED_HOST_PATH(host_path, container_path)
Creates a TrueNAS host path configuration for additional storage mounts, mapping a host directory to a container path.
Example:
"additional_storage": [
"$MOUNTED_HOST_PATH($LOCATION(Movies), /movies)",
"$MOUNTED_HOST_PATH($LOCATION(Shows), /shows)"
]
Expands to:
"additional_storage": [
{
"type": "host_path",
"read_only": false,
"mount_path": "/movies",
"host_path_config": {
"acl_enable": false,
"path": "/mnt/pool/movies"
}
}
]