-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 15 October 2007, Steve Wray wrote:> Hi there,
> I was looking through examples of puppet recipes and came across:
>
> http://reductivelabs.com/trac/puppet/wiki/ClamAV
>
> I notice the exhaustive listing of each files properties and settings
> and wonder if there is a way to have a file inherit settings from other
> files?
>
> Ie instead of:
>
> file { "main_cvd":
> path => "/var/lib/clamav/main.cvd",
> source =>
"puppet://$puppet_server/files/clamav/main.cvd",
> ensure => present,
> mode => 644,
> owner => vscan,
> group => vscan,
> before => SERVICE["clamd"],
> require => PACKAGE["clamav"]
> }
>
> file { "daily_cvd":
> path => "/var/lib/clamav/daily.cvd",
> source =>
"puppet://$puppet_server/files/clamav/daily.cvd",
> ensure => present,
> mode => 644,
> owner => vscan,
> group => vscan,
> before => SERVICE["clamd"],
> require => PACKAGE["clamav"]
> }
>
> file { "clamd_conf":
> path => "/etc/clamd.conf",
> content => template("clamav/clamd.conf"),
> ensure => present,
> mode => 644,
> owner => root,
> group => root,
> before => SERVICE["clamd"],
> require => PACKAGE["clamav"]
> }
>
>
> one could have something like:
>
>
> file { "clamav-base-file":
> ensure => present,
> mode => 644,
> owner => vscan,
> group => vscan,
> before => SERVICE["clamd"],
> require => PACKAGE["clamav"]
> }
>
> file { "daily_cvd":
> path => "/var/lib/clamav/daily.cvd",
> source =>
"puppet://$puppet_server/files/clamav/daily.cvd",
> inherit => "clamav-base-file",
> }
>
> file { "clamd_conf":
> path => "/etc/clamd.conf",
> content => template("clamav/clamd.conf"),
> inherit => "clamav-base-file",
> }
>
>
> Is this possible?
Yes, this is spelled "define":
define clamav_file($path, $content) {
file { $name:
path => $path,
content => $content,
mode => 644, owner => vscan, group => vscan,
require => Package[clamav],
before => Service[clamd],
}
}
Regards, David
- --
The primary freedom of open source is not the freedom from cost, but the free-
dom to shape software to do what you want. This freedom is /never/ exercised
without cost, but is available /at all/ only by accepting the very different
costs associated with open source, costs not in money, but in time and effort.
- -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHExYa/Pp1N6Uzh0URAlfEAJoDFwD9K+fPETItFnjQFREvMybDzACfQq34
k+GCZFVU2MIyD93fgG0KoOg=21tz
-----END PGP SIGNATURE-----