From f239916afcbc30602198f0f38bd8a607d9306448 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 5 Oct 2007 16:04:32 -0400 Subject: Add some examples to the individual defines --- manifests/defines/config_file.pp | 23 ++++++++++++++++++++++- manifests/defines/line.pp | 17 ++++++++++++++++- manifests/defines/replace.pp | 3 ++- 3 files changed, 40 insertions(+), 3 deletions(-) (limited to 'manifests') 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 # 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 # 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: -- cgit v1.2.3