summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authordavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>2007-06-25 07:31:47 +0000
committerdavid <david@f03ff2f1-f02d-0410-970d-b9634babeaa1>2007-06-25 07:31:47 +0000
commit86638cf2c1379b0b03433a037a14b84bb8410b57 (patch)
treee87973a6c8be3d9d4042c27c40599a47df462f9d /manifests
parentdc66a2b9ca234445464fbd2b850ca83779dd7774 (diff)
first steps with the common module
git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@53 f03ff2f1-f02d-0410-970d-b9634babeaa1
Diffstat (limited to 'manifests')
-rw-r--r--manifests/defines/line.pp27
-rw-r--r--manifests/init.pp9
2 files changed, 34 insertions, 2 deletions
diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp
new file mode 100644
index 0000000..2d2e886
--- /dev/null
+++ b/manifests/defines/line.pp
@@ -0,0 +1,27 @@
+# common/manifests/defines/line.pp -- a trivial puppet lined
+# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
+# See LICENSE for the full license granted to you.
+
+# Usage:
+# line { description:
+# file => "filename",
+# line => "content",
+# ensure => {absent,present}
+# }
+define line($file, $line, $ensure) {
+ case $ensure {
+ default : { err ( "unknown ensure value $ensure" ) }
+ present: {
+ exec { "/bin/echo '$line' >> '$file'":
+ unless => "/bin/grep -Fx '$line' '$file'"
+ }
+ }
+ absent: {
+ exec { "/usr/bin/perl -ni -e 'print unless /^\\Q$line\\E$/' '$file'":
+ onlyif => "/bin/grep -Fx '$line' '$file'"
+ }
+ }
+ }
+}
+
+
diff --git a/manifests/init.pp b/manifests/init.pp
index 0a57299..90dae0e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,11 +2,16 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-# Module programmers can use /var/lib/puppet/modules/$modulename to
-# save module-local data, e.g. for constructing config files
file {
+ # Module programmers can use /var/lib/puppet/modules/$modulename to save
+ # module-local data, e.g. for constructing config files
"/var/lib/puppet/modules":
ensure => directory,
mode => 0755, owner => root, group => root;
+ # prepare directories to drop various puppet enhancements
+ [ "$rubysitedir/puppet", "$rubysitedir/facter" ]:
+ ensure => directory,
+ mode => 0755, owner => root, group => root;
}
+import "defines/*.pp"