The following variables enable using host data within templates.
Note that job templates accept only @host
variables.
Name | Description |
---|---|
@host.architecture |
The architecture of the host. |
@host.bond_interfaces |
Returns an array of all bonded interfaces. See [Parsing_Arrays_{context}]. |
@host.capabilities |
The method of system provisioning, can be either build (for example kickstart) or image. |
@host.certname |
The SSL certificate name of the host. |
@host.diskLayout |
The disk layout of the host. Can be inherited from the operating system. |
@host.domain |
The domain of the host. |
@host.environment Deprecated Use the |
The Puppet environment of the host. |
@host.facts |
Returns a Ruby hash of facts from Facter. For example to access the 'ipaddress' fact from the output, specify @host.facts['ipaddress']. |
@host.grub_pass |
Returns the host’s bootloader password. |
@host.hostgroup |
The host group of the host. |
host_enc['parameters'] |
Returns a Ruby hash containing information on host parameters. For example, use host_enc['parameters']['lifecycle_environment'] to get the lifecycle environment of a host. |
@host.image_build? |
Returns |
@host.interfaces |
Contains an array of all available host interfaces including the primary interface. See [Parsing_Arrays_{context}]. |
@host.interfaces_with_identifier('IDs') |
Returns array of interfaces with given identifier. You can pass an array of multiple identifiers as an input, for example @host.interfaces_with_identifier(['eth0', 'eth1']). See [Parsing_Arrays_{context}]. |
@host.ip |
The IP address of the host. |
@host.location |
The location of the host. |
@host.mac |
The MAC address of the host. |
@host.managed_interfaces |
Returns an array of managed interfaces (excluding BMC and bonded interfaces). See [Parsing_Arrays_{context}]. |
@host.medium |
The assigned operating system installation medium. |
@host.name |
The full name of the host. |
@host.operatingsystem.family |
The operating system family. |
@host.operatingsystem.major |
The major version number of the assigned operating system. |
@host.operatingsystem.minor |
The minor version number of the assigned operating system. |
@host.operatingsystem.name |
The assigned operating system name. |
@host.operatingsystem.boot_files_uri(medium_provider) |
Full path to the kernel and initrd, returns an array. |
@host.os.medium_uri(@host) |
The URI used for provisioning (path configured in installation media). |
host_param('parameter_name') |
Returns the value of the specified host parameter. |
host_param_false?('parameter_name') |
Returns |
host_param_true?('parameter_name') |
Returns |
@host.primary_interface |
Returns the primary interface of the host. |
@host.provider |
The compute resource provider. |
@host.provision_interface |
Returns the provisioning interface of the host. Returns an interface object. |
@host.ptable |
The partition table name. |
@host.puppet_ca_server Deprecated Use the |
The Puppet CA server the host must use. |
@host.puppetmaster Deprecated Use the |
The Puppet server the host must use. |
@host.pxe_build? |
Returns |
@host.shortname |
The short name of the host. |
@host.sp_ip |
The IP address of the BMC interface. |
@host.sp_mac |
The MAC address of the BMC interface. |
@host.sp_name |
The name of the BMC interface. |
@host.sp_subnet |
The subnet of the BMC network. |
@host.subnet.dhcp |
Returns |
@host.subnet.dns_primary |
The primary DNS server of the host. |
@host.subnet.dns_secondary |
The secondary DNS server of the host. |
@host.subnet.gateway |
The gateway of the host. |
@host.subnet.mask |
The subnet mask of the host. |
@host.url_for_boot(:initrd) |
Full path to the initrd image associated with this host. Not recommended, as it does not interpolate variables. |
@host.url_for_boot(:kernel) |
Full path to the kernel associated with this host. Not recommended, as it does not interpolate variables, prefer boot_files_uri. |
@provisioning_type |
Equals to 'host' or 'hostgroup' depending on type of provisioning. |
@static |
Returns |
@template_name |
Name of the template being rendered. |
grub_pass |
Returns a bootloader argument to set the encrypted bootloader password, such as --md5pass=#{@host.grub_pass}. |
ks_console |
Returns a string assembled using the port and the baud rate of the host which can be added to a kernel line. For example console=ttyS1,9600. |
root_pass |
Returns the root password configured for the system. |
The majority of common Ruby methods can be applied on host-specific variables. For example, to extract the last segment of the host’s IP address, you can use:
<% @host.ip.split('.').last %>