Project

General

Profile

TemplateWriting » History » Version 9

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