Building config files using snippets
How do you eat an elephant? One bite at a time. Sometimes you have a situation where you want to build up a single config file from various snippets managed by different classes. For example, you might have two or three services that require rsync
modules to be configured, so you can't distribute a single rsyncd.conf
. Although you could use Augeas, there's a simple way to concatenate config snippets together into a single file using an exec
resource.
How to do it…
- Create the file
/etc/puppet/modules/admin/manifests/rsyncdconf.pp
with the following contents:class admin::rsyncdconf { file { "/etc/rsyncd.d": ensure => directory, } exec { "update-rsyncd.conf": command => "/bin/cat /etc/rsyncd.d/*.conf > /etc/rsyncd.conf", ...
Get Puppet 2.7 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.