Skip to content

discovery-hostname-template

A map of ssh public keys to install for the root user

If a system needs a customized way to get the hostname, which is subsequently used to initially set the Machine object Name field, then set the Param discovery-hostname-selector to the value of external-template and set this Param to the name of a BASH based template that sets the Shell Variable HOSTNAME to a validly formed name.

This template will be injected inside of a BASH case statement. It must be valid BASH, and ultimately it must set the Shell variable HOSTNAME correctly.

An example External Template that generates a random 8 character string which would be set to the HOSTNAME might look like:

# do not use /dev/urandom directly - not enough entropy on VMs
HOSTNAME=$(pwmake 256 | tr -dc 'a-zA-Z' | fold -w 8 | head -n 1)

Setting the two Params as described above with a template like this has the effect of setting the Discovery/Sledgehammer hostname to the random string, and the newly created machine object Name field will also be set to this string.

Note

If the discovery-hostname-selector is set to use external-template, but no template is specified in the discovery-hostname-template Param, then the default behavior of using the dMAC (eg 'd00-00-00-12-34-56') value will be used. This allows the discovery process to continue successfully.

Warning

If the injecte external template produces BASH shell errors, the start-up.sh script will fail, and no new Machine object will be created.