first steps with the common module

git-svn-id: http://club.black.co.at:82/svn/manifests/trunk@53 f03ff2f1-f02d-0410-970d-b9634babeaa1
This commit is contained in:
david 2007-06-25 07:31:47 +00:00
parent dc66a2b9ca
commit 86638cf2c1
2 changed files with 34 additions and 2 deletions

27
manifests/defines/line.pp Normal file
View file

@ -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'"
}
}
}
}

View file

@ -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"