| 1 |
Templates |
| 2 |
========= |
| 3 |
|
| 4 |
Puppet supports templates and templating via ERB, which is part of the Ruby |
| 5 |
standard library and is used for many other projects including Ruby on Rails. |
| 6 |
Templates allow you to manage the content of template files, for example |
| 7 |
configuration files that cannot yet be managed as a Puppet type. Learn more at |
| 8 |
http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Templating |
| 9 |
|
| 10 |
You can use templates like this: |
| 11 |
|
| 12 |
class myclass { |
| 13 |
package { mypackage: ensure => latest } |
| 14 |
service { myservice: ensure => running } |
| 15 |
file { "/etc/myfile": |
| 16 |
content => template("mymodule/myfile.erb") |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
The templates are searched for in: |
| 21 |
|
| 22 |
$templatedir/mymodule/myfile.erb |
| 23 |
$modulepath/mymodule/templates/myfile.erb |