89be6dc2f6
as 'server'. This didn't work as expected because of this error, and in some situations it caused problems (such as when ever file in a directory is considered a config file, such is the case with apt.conf.d )
58 lines
1.3 KiB
Puppet
58 lines
1.3 KiB
Puppet
# common/manifests/defines/config_file.pp -- create a config file with default permissions
|
|
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
# See LICENSE for the full license granted to you.
|
|
|
|
# A simple wrapper to give all configuration files common defaults.
|
|
#
|
|
# Usage:
|
|
# config_file { filename:
|
|
# content => "....\n",
|
|
# }
|
|
#
|
|
# Examples:
|
|
#
|
|
# To create the file /etc/vservers/${vs_name}/context with specific
|
|
# content:
|
|
#
|
|
# config_file {
|
|
# "/etc/vservers/${vs_name}/context":
|
|
# content => "${context}\n",
|
|
# notify => Exec["vs_restart_${vs_name}"],
|
|
# require => Exec["vs_create_${vs_name}"];
|
|
# }
|
|
#
|
|
# To create the file /etc/apache2/sites-available/munin-stats with the
|
|
# content pulled from a template:
|
|
#
|
|
# config_file {
|
|
# "/etc/apache2/sites-available/munin-stats":
|
|
# content => template("apache/munin-stats"),
|
|
# require => Package["apache2"],
|
|
# notify => Exec["reload-apache2"];
|
|
# }
|
|
define config_file (
|
|
$content = '',
|
|
$source = '',
|
|
$ensure = 'present')
|
|
{
|
|
file { $name:
|
|
ensure => $ensure,
|
|
# default permissions for config files
|
|
mode => 0644, owner => root, group => 0,
|
|
# really detect changes to this file
|
|
checksum => md5,
|
|
}
|
|
|
|
case $source {
|
|
'': { }
|
|
default: { File[$name] { source => $source } }
|
|
}
|
|
|
|
case $content {
|
|
'': { }
|
|
default: { File[$name] { content => $content } }
|
|
}
|
|
|
|
}
|
|
|
|
|