diff options
author | Micah Anderson <micah@riseup.net> | 2007-10-05 16:04:32 -0400 |
---|---|---|
committer | David Schmitt <david@schmitt.edv-bus.at> | 2007-10-08 11:40:09 +0200 |
commit | f239916afcbc30602198f0f38bd8a607d9306448 (patch) | |
tree | c6a435d493a9d2bb973ebd4922149a66049d2f0c | |
parent | ad81b0f97758cb4948a696833581d1bd3c933e3d (diff) | |
download | puppet-common-f239916afcbc30602198f0f38bd8a607d9306448.tar.gz puppet-common-f239916afcbc30602198f0f38bd8a607d9306448.tar.bz2 |
Add some examples to the individual defines
-rw-r--r-- | manifests/defines/config_file.pp | 23 | ||||
-rw-r--r-- | manifests/defines/line.pp | 17 | ||||
-rw-r--r-- | manifests/defines/replace.pp | 3 |
3 files changed, 40 insertions, 3 deletions
diff --git a/manifests/defines/config_file.pp b/manifests/defines/config_file.pp index 4433878..e539c6d 100644 --- a/manifests/defines/config_file.pp +++ b/manifests/defines/config_file.pp @@ -1,4 +1,4 @@ -# 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. @@ -6,6 +6,27 @@ # 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, diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp index 6026a84..42bd5a1 100644 --- a/manifests/defines/line.pp +++ b/manifests/defines/line.pp @@ -1,4 +1,4 @@ -# 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. @@ -8,6 +8,21 @@ # 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" ) } diff --git a/manifests/defines/replace.pp b/manifests/defines/replace.pp index fcff84d..d1c7496 100644 --- a/manifests/defines/replace.pp +++ b/manifests/defines/replace.pp @@ -9,7 +9,8 @@ # 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: |