To utilise a templates when creating new files we can issue something like: /etc/puppetlabs/code/environments/production/manifests/site.pp
file { '/etc/issue':
ensure => present,
owner => 'root',
group => 'root',
mode => 0644,
content => template($module_name/issue.erb),
}
The source / content must be stored within a puppet module - so in the case we were using Saz's SSH module - we would place the template in:
/etc/puppetlabs/code/environments/production/modules/ssh/templates
touch /etc/puppetlabs/code/environments/production/modules/ssh/templates/issue.erb
and the site.pp file would look something like:
file { '/etc/issue':
ensure => present,
owner => 'root',
group => 'root',
mode => 0644,
content => template($ssh/issue.erb),
}
Reload the puppet server:
sudo service puppetserver reload
and pull down the configuration on the client:
puppet agent -t
0 comments:
Post a Comment