Variables
To create more dynamic PXE profiles, disk layouts, and scripts, variables are available. These variables use a dotted syntax of the server array and are prefixed by "server". More information on the server array can be found in the API documentation.
Variable examples:
- Hostname:
{{server.hostname}}
- Access an array:
{{server.powerprovider.type}}
In addition to the above variables,the following variables are available. While some variables are already accessible in the dotted server array, they are offered as convenient shortcuts.
- root password:
{{rootpassword}}
- Encrypted root password:
{{encryptedRootpassword}}
- Primary IPv4 address:
{{ipv4}}
- Netmask of the primary IPv4 address:
{{netmask}}
- Gateway of the primary IPv4 address:
{{gatewayv4}}
- CIDR of the primary IPv4 address:
{{cidr}}
- PXE MAC:
{{mac}}
- Timezone of the PXE profile:
{{timezone}}
- Hostname of the remote agent:
{{agentHostname}}
- All server comments:
{{server.comments}}
- Server inventory:
{{server.inventory}}
- Server inventory with type as keys:
{{server.inventory_by_type}}
(as example,{{server.inventory_by_type.cpu.0}}
- the key corresponds to the "System Name" of the inventory component)
By utilizing variables, it is possible to install an OS in a more dynamic manner and use dependent data from the server. If a variable does not exist and is prefixed by "server.", it will be removed from the submitted data before the installation process begins.
Handling Arrays
To access specific array entries, use the dot syntax, for example:
{{server.ipassignments.0.ip}}
To retrieve the entire array, use: {{server.ipassignments}}
. The content is provided in JSON format and can be further processed using tools like jq
.
To view the full content of the server array, use:
echo '{{server}}' > /root/server