-# common/manifests/defines/config_file.pp -- put a config file with default permissions
+# 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.
# 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) {
file { $name:
content => $content,
-# common/manifests/defines/line.pp -- a trivial puppet lined
+# common/manifests/defines/line.pp -- a trivial mechanism to ensure a line exists in a file
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# line => "content",
# ensure => {absent,*present*}
# }
+#
+# Example:
+# The following ensures that the line "allow ^$munin_host$" exists
+# in /etc/munin/munin-node.conf, and if there are any changes notify the service for
+# a restart
+#
+# line { allow_munin_host:
+# file => "/etc/munin/munin-node.conf",
+# line => "allow ^$munin_host$",
+# ensure => present,
+# notify => Service[munin-node],
+# require => Package[munin-node],
+# }
+#
+#
define line($file, $line, $ensure = 'present') {
case $ensure {
default : { err ( "unknown ensure value $ensure" ) }
# pattern => "regexp",
# replacement => "replacement"
#
-# For example, to replace the current port in /etc/munin/munin-node.conf
+# Example:
+# To replace the current port in /etc/munin/munin-node.conf
# with a new port, but only disturbing the file when needed:
#
# replace { set_munin_node_port: