Project

General

Profile

TemplateWriting » History » Version 8

Justin Sherrill, 02/01/2011 05:35 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 8 Justin Sherrill
There are two ways to render a template, based on a single host, or based on a Hostgroup.
11
12
h3. Host-based Rendering
13
14
15
16
17
h3. Hostgroup-based rendering
18
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:
19
20
/unattended/template/Template Name/Hostgroup Name
21
22
For example, a hostgroup of name Finance, and a template named WebServerKickstart could be rendered using the url:
23
24
/unattended/template/WebServerKickstart/Hostgroup
25
26
27
h2. Writing templates
28
29
30
31
h2. Functions and macros:
32
33 1 Justin Sherrill
|_.Name|_.Description|_.Example|
34
|root_pass  |The root password configured for the system| |
35 7 Justin Sherrill
|ks_console | | |
36 6 Justin Sherrill
|snippets(name)   | Renders the specified snippet | |
37 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 |
38
|@host                |The name of the host| |
39
|@host.name                |The name of the host| |
40
|@host.diskLayout     |The disklayout of the host (could come from the operating system)| |
41
|@host.puppetmaster   |The puppetmaster the host should use | |
42
|@host.architecture   |The arch of the host (i.e. x86_64)| |
43
|@host.operatingsystem|The operating system name| |
44
|@host.operatingsystem.media_url |||
45
|@host.operatingsystem.major |The major version of the OS||
46
|@host.operatingsystem.minor |The minor version of the OS||
47
|@host.operatingsystem.family |The OS Family (I.e. redhat, debian, etc.)||
48
|@host.url_for_boot(:kernel) |||
49
|@host.url_for_boot(:initrd) |||
50
51
52 2 Justin Sherrill
53 8 Justin Sherrill
h3. Kickstart only variables:
54 1 Justin Sherrill
55
|_.Name|_.Description|_.Example|
56
|@dynamic |||
57
|@osver |||
58
|@arch |||
59
|@mediapath |||
60
|@epel |||
61
|@yumrepo |||
62
|@static |||
63
64 8 Justin Sherrill
h3. Preseed attributes:
65 6 Justin Sherrill
66 1 Justin Sherrill
|_.Name|_.Description|_.Example|
67
|@preseed_path |||
68
|@preseed_server |||