Project

General

Profile

TemplateWriting » History » Revision 10

Revision 9 (Justin Sherrill, 02/01/2011 05:35 PM) → Revision 10/110 (Justin Sherrill, 02/01/2011 05:40 PM)

h1. Templates 



 The following functions and macros can be used within templates.    These are guaranteed to work via the safemode rendering, to ensure a template can do nothing harmful.    With safemode disabled ($$ADD instructions here$$), other macros may work, but are not supported at this time. 


 h2. Accessing Templates 

 There are two ways to render a template, based on a single host, or based on a Hostgroup.    The host or hostgroup provides all the details with which to render the template.   


 

 h3. Host-based Rendering 




 h3. Hostgroup-based rendering 

 Allows any template to be rendered for any Hostgroup.    When rendering using a hostgroup, @host is actually the hostgroup instead of a defined host. The default values for the hostgroup are used for templated values.    This means if a value is not set in the hostgroup, you may get an error when rendering the template.    To access a template using a Hostgroup to render, simply use this URL: 

 /unattended/template/Template Name/Hostgroup Name 

 For example, a hostgroup of name Finance, and a template named WebServerKickstart could be rendered using the url: 

 /unattended/template/WebServerKickstart/Hostgroup 

 h4.    PXE Menus 

 Pxe Menus can be deployed to smart proxies from the Config Tempalates. 

 


 h2. Writing templates 



 h2. Functions and macros: 

 |_.Name|_.Description|_.Example| 
 |root_pass    |The root password configured for the system| | 
 |ks_console | | | 
 |snippets(name)     | Renders the specified snippet | | 
 |foreman_url(kind)| Provides the full URL to a host-rendered template of the given kind    | foreman_url("provision") =>    http://HOST/unattended/provision | 
 |@host                  |The name of the host| | 
 |@host.name                  |The name of the host| | 
 |@host.diskLayout       |The disklayout of the host (could come from the operating system)| | 
 |@host.puppetmaster     |The puppetmaster the host should use | | 
 |@host.architecture     |The arch of the host (i.e. x86_64)| | 
 |@host.operatingsystem|The operating system name| | 
 |@host.operatingsystem.media_url ||| 
 |@host.operatingsystem.major |The major version of the OS|| 
 |@host.operatingsystem.minor |The minor version of the OS|| 
 |@host.operatingsystem.family |The OS Family (I.e. redhat, debian, etc.)|| 
 |@host.url_for_boot(:kernel) ||| 
 |@host.url_for_boot(:initrd) ||| 



 h3. Kickstart only variables: 

 |_.Name|_.Description|_.Example| 
 |@dynamic ||| 
 |@osver ||| 
 |@arch ||| 
 |@mediapath ||| 
 |@epel ||| 
 |@yumrepo ||| 
 |@static ||| 

 h3. Preseed attributes: 

 |_.Name|_.Description|_.Example| 
 |@preseed_path ||| 
 |@preseed_server |||