Project

General

Profile

TemplateWriting » History » Version 11

Justin Sherrill, 02/01/2011 05:41 PM

1 1 Justin Sherrill
h1. Templates
2
3
4
5 4 Justin Sherrill
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.
6 1 Justin Sherrill
7
8 8 Justin Sherrill
h2. Accessing Templates
9 1 Justin Sherrill
10 10 Justin Sherrill
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.  
11 1 Justin Sherrill
12 10 Justin Sherrill
13 8 Justin Sherrill
h3. Host-based Rendering
14
15
16
17
18
h3. Hostgroup-based rendering
19 9 Justin Sherrill
20 8 Justin Sherrill
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:
21
22
/unattended/template/Template Name/Hostgroup Name
23
24
For example, a hostgroup of name Finance, and a template named WebServerKickstart could be rendered using the url:
25
26 11 Justin Sherrill
/unattended/template/WebServerKickstart/Finance
27 1 Justin Sherrill
28 10 Justin Sherrill
h4.  PXE Menus
29
30
Pxe Menus can be deployed to smart proxies from the Config Tempalates.
31 8 Justin Sherrill
32
h2. Writing templates
33
34
35
36
h2. Functions and macros:
37
38 1 Justin Sherrill
|_.Name|_.Description|_.Example|
39
|root_pass  |The root password configured for the system| |
40 7 Justin Sherrill
|ks_console | | |
41 6 Justin Sherrill
|snippets(name)   | Renders the specified snippet | |
42 1 Justin Sherrill
|foreman_url(kind)| Provides the full URL to a host-rendered template of the given kind  | foreman_url("provision") =>  http://HOST/unattended/provision |
43
|@host                |The name of the host| |
44
|@host.name                |The name of the host| |
45
|@host.diskLayout     |The disklayout of the host (could come from the operating system)| |
46
|@host.puppetmaster   |The puppetmaster the host should use | |
47
|@host.architecture   |The arch of the host (i.e. x86_64)| |
48
|@host.operatingsystem|The operating system name| |
49
|@host.operatingsystem.media_url |||
50
|@host.operatingsystem.major |The major version of the OS||
51
|@host.operatingsystem.minor |The minor version of the OS||
52
|@host.operatingsystem.family |The OS Family (I.e. redhat, debian, etc.)||
53
|@host.url_for_boot(:kernel) |||
54
|@host.url_for_boot(:initrd) |||
55
56
57 2 Justin Sherrill
58 8 Justin Sherrill
h3. Kickstart only variables:
59 1 Justin Sherrill
60
|_.Name|_.Description|_.Example|
61
|@dynamic |||
62
|@osver |||
63
|@arch |||
64
|@mediapath |||
65
|@epel |||
66
|@yumrepo |||
67
|@static |||
68
69 8 Justin Sherrill
h3. Preseed attributes:
70 6 Justin Sherrill
71 1 Justin Sherrill
|_.Name|_.Description|_.Example|
72
|@preseed_path |||
73
|@preseed_server |||